1. 程式人生 > 其它 >記一次Ubuntu系統修改自帶Python軟連線的錯誤

記一次Ubuntu系統修改自帶Python軟連線的錯誤

作業系統;Ubuntu 20.04

剛裝上系統,看了一下有Python,由於是Python3.10,所有想將Python3命令修改為Python命令,感覺更順手,於是就把  /usr/bin/目錄下的Python3軟連線名稱修改成了Python

命令:sudo apt-get upgrade 報錯資訊:Reading package lists... Done Building dependency tree... Done Reading state information... Done Calculating upgrade... Done The following packages have been kept back:
python3-distupgrade ubuntu-release-upgrader-core The following packages will be upgraded: cloud-init 1 upgraded, 0 newly installed, 0 to remove and 2 not upgraded. 1 not fully installed or removed. Need to get 0 B/526 kB of archives. After this operation, 121 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y Preconfiguring packages ... (Reading database ... 70652 files and directories currently installed.) Preparing to unpack .../cloud-init_22.4.2-0ubuntu0~22.04.1_all.deb ... /var/lib/dpkg/info/cloud-init.prerm: 19: py3clean: not found dpkg: warning: old cloud-init package pre-removal script subprocess returned error exit status 127
dpkg: trying script from the new package instead ... /var/lib/dpkg/tmp.ci/prerm: 19: py3clean: not found dpkg: error processing archive /var/cache/apt/archives/cloud-init_22.4.2-0ubuntu0~22.04.1_all.deb (--unpack): new cloud-init package pre-removal script subprocess returned error exit status 127 /var/lib/dpkg/info/cloud-init.postinst: 414: py3compile: not found dpkg: error while cleaning up: installed cloud-init package post-installation script subprocess returned error exit status 127 Errors were encountered while processing: /var/cache/apt/archives/cloud-init_22.4.2-0ubuntu0~22.04.1_all.deb E: Sub-process /usr/bin/dpkg returned an error code (1)

 修改之後發現apt命令出問題了,網上找半天說和info資料夾有關,照著弄一直沒有弄好,由於是新裝的系統,只動了系統裡面的Python所以我改回來就正常了

總結:Ubuntu中自帶的Python沒必要不要去動,需要直接用Python再建立一個軟連線即可

ln -s 原始檔 目標檔案

ln -s /usr/bin/Python.3.10  /usr/bin/Python