由于 python3 包损坏,无法安装/卸载

由于 python3 包损坏,无法安装/卸载

无法通过终端和软件中心安装或卸载任何包。

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 aptdaemon : Depends: python3-aptdaemon (= 1.1.1-1ubuntu5.1) but 1.1.1-1ubuntu5 is to be installed
 ubuntu-release-upgrader-core : Depends: python3-distupgrade (= 1:0.220.6) but 1:0.220.2 is to be installed
 ubuntu-release-upgrader-gtk : Depends: python3-distupgrade (= 1:0.220.6) but 1:0.220.2 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

尝试过

sudo apt-get -configure -a 

还可以通过 aptitude 修复损坏的依赖项。但是,得到同样的错误,还尝试执行,

sudo apt-get -f install

但它给出了如下错误:

Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Aborted (core dumped)
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 134
Errors were encountered while processing:
 /var/cache/apt/archives/python3-aptdaemon.pkcompat_1.1.1-1ubuntu5.1_all.deb
 /var/cache/apt/archives/python3-aptdaemon.gtk3widgets_1.1.1-1ubuntu5.1_all.deb
 /var/cache/apt/archives/python3-aptdaemon_1.1.1-1ubuntu5.1_all.deb
 /var/cache/apt/archives/language-selector-gnome_0.129.3_all.deb
 /var/cache/apt/archives/language-selector-common_0.129.3_all.deb
 /var/cache/apt/archives/ubuntu-drivers-common_1%3a0.2.91.7_amd64.deb
 /var/cache/apt/archives/python3-distupgrade_1%3a0.220.6_all.deb
 /var/cache/apt/archives/python3-uno_1%3a4.2.7-0ubuntu2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

如有任何帮助我将不胜感激!


Sudo apt-get -f install 给出与之前提到的相同的错误:

subprocess new pre-removal script returned error exit status 134
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Aborted (core dumped)
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 134
Errors were encountered while processing:
 /var/cache/apt/archives/python3-aptdaemon.pkcompat_1.1.1-1ubuntu5.1_all.deb
 /var/cache/apt/archives/python3-aptdaemon.gtk3widgets_1.1.1-1ubuntu5.1_all.deb
 /var/cache/apt/archives/python3-aptdaemon_1.1.1-1ubuntu5.1_all.deb
 /var/cache/apt/archives/language-selector-gnome_0.129.3_all.deb
 /var/cache/apt/archives/language-selector-common_0.129.3_all.deb
 /var/cache/apt/archives/ubuntu-drivers-common_1%3a0.2.91.7_amd64.deb
 /var/cache/apt/archives/python3-distupgrade_1%3a0.220.7_all.deb
 /var/cache/apt/archives/python3-uno_1%3a4.2.7-0ubuntu2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我无法安装或卸载任何软件包,并且出现以下错误:

Errors were encountered while processing:
 python3
 python3-apt
 language-selector-common
 ubuntu-drivers-common
 update-notifier-common
 apparmor
 python3-distupgrade
 ubuntu-release-upgrader-core
 python3-problem-report
 python3-apport
 apport
 apport-gtk
 python3-aptdaemon
 aptdaemon
 python3-aptdaemon.gtk3widgets
 language-selector-gnome
 python3-urllib3
 python3-requests
 python3-software-properties
 software-properties-common
 python3-uno
 software-properties-gtk
 python3-aptdaemon.pkcompat
 system-config-printer-gnome
 ubuntu-release-upgrader-gtk
 update-notifier
 usb-creator-common
 usb-creator-gtk
 xul-ext-ubufox
E: Sub-process /usr/bin/dpkg returned an error code (1)

请提供任何帮助!

答案1

尝试以下命令:

sudo apt-get clean
sudo apt-get update
sudo apt-get -f install

相关内容