每当我尝试安装任何程序时,Ubuntu 都会显示此信息;
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
gedit
Suggested packages:
gedit-plugins
The following packages will be upgraded:
gedit
1 upgraded, 0 newly installed, 0 to remove and 83 not upgraded.
24 not fully installed or removed.
Need to get 0 B/408 kB of archives.
After this operation, 8,192 B disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 281827 files and directories currently installed.)
Preparing to unpack .../gedit_3.28.1-1ubuntu1.2_amd64.deb ...
/var/lib/dpkg/info/gedit.prerm: 12: /var/lib/dpkg/info/gedit.prerm: py3clean: not found
dpkg: warning: old gedit package pre-removal script subprocess returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 12: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/gedit_3.28.1-1ubuntu1.2_amd64.deb (--unpack):
new gedit package pre-removal script subprocess returned error exit status 127
/var/lib/dpkg/info/gedit.postinst: 32: /var/lib/dpkg/info/gedit.postinst: py3compile: not found
dpkg: error while cleaning up:
installed gedit package post-installation script subprocess returned error exit status 127
Errors were encountered while processing:
/var/cache/apt/archives/gedit_3.28.1-1ubuntu1.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
您发布的日志中的两行重要内容是:
/var/lib/dpkg/info/gedit.prerm: 12: /var/lib/dpkg/info/gedit.prerm: py3clean: not found
和:
/var/lib/dpkg/info/gedit.postinst: 32: /var/lib/dpkg/info/gedit.postinst: py3compile: not found
它们告诉我们您缺少py3clean
和py3compile
,这两者都是 Python 安装(具体来说,Python 3)的一部分。您的 Python 已损坏。
有几种方法可以解决这个问题。尝试运行
apt-get -f install
和/或
dpkg --configure -a
以 root 身份运行。这两个命令都会尝试查找并修复损坏的依赖项。如果它们不起作用(它们很可能不起作用——它们是有用的命令,但不是万能药),请尝试以下各种答案给出的步骤:这个问题。