记一次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
浙公网安备 33010602011771号