Ubuntu 16.04 完全破坏了 python3 + dpkg + apt-get!

Ubuntu 16.04 完全破坏了 python3 + dpkg + apt-get!

也许有人可以帮助我度过这个地狱:

这一切都是因为我遇到这个错误:https://askubuntu.com/a/1034266/570817

我试图以某种方式删除ppa:jonathonf/python-3.6安装,但我一开始就做错了,只是删除了 python3 文件/usr/bin/python3*

然后我继续以持续的速度直奔地狱,通过在其他类似的帖子中尝试不同的提示,现在我将发布其中一些的完整输出:

首先,我sudo apt-get remove python3...

然后我得到以下输出:

sudo dpkg --configure -a
dpkg: dependency problems prevent configuration of python3:
 python3 depends on dh-python; however:
  Package dh-python is not configured yet.

dpkg: error processing package python3 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of update-notifier-common:
 update-notifier-common depends on python3:any; however:
  Package python3 is not configured yet.

dpkg: error processing package update-notifier-common (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-update-manager:
 python3-update-manager depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.

dpkg: error processing package python3-update-manager (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of apport-gtk:
 apport-gtk depends on python3; however:
  Package python3 is not configured yet.

dpkg: error processing package apport-gtk (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of apturl:
 apturl depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.

dpkg: error processing package apturl (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of ubuntu-release-upgrader-core:
 ubuntu-release-upgrader-core depends on python3:any (>= 3.2~); however:
  Package python3 is not configured yet.

dpkg: error processing package ubuntu-release-upgrader-core (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of apturl-common:
 apturl-common depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.
 apturl-common depends on python3-update-manager; however:
  Package python3-update-manager is not configured yet.

dpkg: error processing package apturl-common (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of update-notifier:
 update-notifier depends on update-notifier-common (= 3.168.9); however:
  Package update-notifier-common is not configured yet.

dpkg: error processing package update-notifier (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of aptdaemon:
 aptdaemon depends on python3; however:
  Package python3 is not configured yet.
 aptdaemon depends on python3:any (>= 3.2~); however:
  Package python3 is not configured yet.

dpkg: error processing package aptdaemon (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-requests:
 python3-requests depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.

dpkg: error processing package python3-requests (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of apport:
 apport depends on python3; however:
  Package python3 is not configured yet.

dpkg: error processing package apport (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of update-manager:
 update-manager depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.
 update-manager depends on update-manager-core (= 1:16.04.13); however:
  Version of update-manager-core on system is 1:16.04.15.
 update-manager depends on update-notifier; however:
  Package update-notifier is not configured yet.

dpkg: error processing package update-manager (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-urllib3:
 python3-urllib3 depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.

dpkg: error processing package python3-urllib3 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent processing triggers for gnome-menus:
 gnome-menus depends on python3:any (>= 3.1~); however:
  Package python3 is not configured yet.

dpkg: error processing package gnome-menus (--configure):
 dependency problems - leaving triggers unprocessed
dpkg: dependency problems prevent configuration of python3-distupgrade:
 python3-distupgrade depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.
 python3-distupgrade depends on python3-update-manager (>= 1:0.196.2~); however:
  Package python3-update-manager is not configured yet.

dpkg: error processing package python3-distupgrade (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of ubuntu-release-upgrader-gtk:
 ubuntu-release-upgrader-gtk depends on ubuntu-release-upgrader-core (= 1:16.04.25); however:
  Package ubuntu-release-upgrader-core is not configured yet.
 ubuntu-release-upgrader-gtk depends on update-manager; however:
  Package update-manager is not configured yet.
 ubuntu-release-upgrader-gtk depends on python3-distupgrade (= 1:16.04.25); however:
  Package python3-distupgrade is not configured yet.

dpkg: error processing package ubuntu-release-upgrader-gtk (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of update-manager-core:
 update-manager-core depends on python3:any (>= 3.2~); however:
  Package python3 is not configured yet.
 update-manager-core depends on python3-update-manager (= 1:16.04.15); however:
  Package python3-update-manager is not configured yet.
 update-manager-core depends on ubuntu-release-upgrader-core; however:
  Package ubuntu-release-upgrader-core is not configured yet.

dpkg: error processing package update-manager-core (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of gconf2:
 gconf2 depends on python3:any; however:
  Package python3 is not configured yet.

dpkg: error processing package gconf2 (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python3
 update-notifier-common
 python3-update-manager
 apport-gtk
 apturl
 ubuntu-release-upgrader-core
 apturl-common
 update-notifier
 aptdaemon
 python3-requests
 apport
 update-manager
 python3-urllib3
 gnome-menus
 python3-distupgrade
 ubuntu-release-upgrader-gtk
 update-manager-core
 gconf2

sudo apt-get -f install

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  appstream compiz-core compiz-plugins-default gnome-software-common guile-2.0-libs libapparmor-perl libappstream3 libcompizconfig0 libdecoration0 libjemalloc1
  libmetacity-private3a libopencolorio1v5 libopenimageio1.6 libsnapd-glib1 libspnav0 libyaml-cpp0.3v5 metacity-common python-backports.ssl-match-hostname
  python-cached-property python-docker python-dockerpty python-docopt python-funcsigs python-functools32 python-jsonschema python-mock python-pbr python-texttable
  python-websocket python-yaml run-one snapd-login-service tmux
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  apturl apturl-common python3-requests update-manager
Suggested packages:
  python3-ndg-httpsclient python3-openssl
The following NEW packages will be installed:
  python3-requests
The following packages will be upgraded:
  apturl apturl-common update-manager
3 upgraded, 1 newly installed, 0 to remove and 176 not upgraded.
21 not fully installed or removed.
Need to get 55,8 kB/619 kB of archives.
After this operation, 254 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://at.archive.ubuntu.com/ubuntu xenial-updates/main amd64 python3-requests all 2.9.1-3ubuntu0.1 [55,8 kB]
Fetched 55,8 kB in 0s (537 kB/s)           
dpkg: warning: files list file for package 'python3.5' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-ipy' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-gdbm-dbg:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-speechd' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-xlsxwriter' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pycurl' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pil:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-cups' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3.6' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-apt' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-dbus' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pyatspi' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-plainbox' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-lxml' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-brlapi' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-mako' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-commandnotfound' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-padme' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-xdg' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-six' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3.5-venv' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pyparsing' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3.6-minimal' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-dev' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-guacamole' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-newt' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-aptdaemon.gtk3widgets' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-wheel' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-gi-cairo' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pkg-resources' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-gi' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-bs4' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-apport' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-markupsafe' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3.5-minimal' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-defer' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-problem-report' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-reportlab' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pyasn1' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-uno' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pexpect' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-chardet' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-aptdaemon' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-systemd' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-jinja2' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-html5lib' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-minimal' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pip' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-cupshelpers' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-gdbm:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-software-properties' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-reportlab-accel:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-cairo' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-setuptools' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-aptdaemon.pkcompat' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3.5-dev' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-ptyprocess' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-checkbox-support' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-debian' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-renderpm:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-xkit' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-venv' missing; assuming package has no files currently installed
(Reading database ... 429592 files and directories currently installed.)
Preparing to unpack .../update-manager_1%3a16.04.15_all.deb ...
/var/lib/dpkg/info/update-manager.prerm: 6: /var/lib/dpkg/info/update-manager.prerm: py3clean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/update-manager_1%3a16.04.15_all.deb (--unpack):
 subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/update-manager.postinst: 6: /var/lib/dpkg/info/update-manager.postinst: py3compile: not found
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 127
Preparing to unpack .../apturl_0.5.2ubuntu11.2_amd64.deb ...
/var/lib/dpkg/info/apturl.prerm: 6: /var/lib/dpkg/info/apturl.prerm: py3clean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/apturl_0.5.2ubuntu11.2_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/apturl.postinst: 6: /var/lib/dpkg/info/apturl.postinst: py3compile: not found
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 127
Preparing to unpack .../apturl-common_0.5.2ubuntu11.2_amd64.deb ...
/var/lib/dpkg/info/apturl-common.prerm: 6: /var/lib/dpkg/info/apturl-common.prerm: py3clean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/apturl-common_0.5.2ubuntu11.2_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/apturl-common.postinst: 27: /var/lib/dpkg/info/apturl-common.postinst: py3compile: not found
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 127
Selecting previously unselected package python3-requests.
Preparing to unpack .../python3-requests_2.9.1-3ubuntu0.1_all.deb ...
Unpacking python3-requests (2.9.1-3ubuntu0.1) ...
Errors were encountered while processing:
 /var/cache/apt/archives/update-manager_1%3a16.04.15_all.deb
 /var/cache/apt/archives/apturl_0.5.2ubuntu11.2_amd64.deb
 /var/cache/apt/archives/apturl-common_0.5.2ubuntu11.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

sudo apt-get install python3

Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3 is already the newest version (3.5.1-3).
python3 set to manually installed.
The following packages were automatically installed and are no longer required:
  appstream compiz-core compiz-plugins-default gnome-software-common guile-2.0-libs libapparmor-perl libappstream3 libcompizconfig0 libdecoration0 libjemalloc1
  libmetacity-private3a libopencolorio1v5 libopenimageio1.6 libsnapd-glib1 libspnav0 libyaml-cpp0.3v5 metacity-common python-backports.ssl-match-hostname
  python-cached-property python-docker python-dockerpty python-docopt python-funcsigs python-functools32 python-jsonschema python-mock python-pbr python-texttable
  python-websocket python-yaml run-one snapd-login-service tmux
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  apturl apturl-common update-manager
The following packages will be upgraded:
  apturl apturl-common update-manager
3 upgraded, 0 newly installed, 0 to remove and 176 not upgraded.
22 not fully installed or removed.
Need to get 0 B/563 kB of archives.
After this operation, 1.024 B of additional disk space will be used.
Do you want to continue? [Y/n] 
dpkg: warning: files list file for package 'python3.5' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-ipy' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-gdbm-dbg:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-speechd' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-xlsxwriter' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pycurl' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pil:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-cups' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3.6' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-apt' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-dbus' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pyatspi' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-plainbox' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-lxml' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-brlapi' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-mako' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-commandnotfound' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-padme' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-xdg' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-six' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3.5-venv' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pyparsing' missing; assuming package has no files currently installed
...
dpkg: warning: files list file for package 'python3-setuptools' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-aptdaemon.pkcompat' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3.5-dev' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-ptyprocess' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-checkbox-support' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-debian' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-renderpm:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-xkit' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-venv' missing; assuming package has no files currently installed
(Reading database ... 429618 files and directories currently installed.)
Preparing to unpack .../update-manager_1%3a16.04.15_all.deb ...
/var/lib/dpkg/info/update-manager.prerm: 6: /var/lib/dpkg/info/update-manager.prerm: py3clean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/update-manager_1%3a16.04.15_all.deb (--unpack):
 subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/update-manager.postinst: 6: /var/lib/dpkg/info/update-manager.postinst: py3compile: not found
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 127
Preparing to unpack .../apturl_0.5.2ubuntu11.2_amd64.deb ...
/var/lib/dpkg/info/apturl.prerm: 6: /var/lib/dpkg/info/apturl.prerm: py3clean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/apturl_0.5.2ubuntu11.2_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/apturl.postinst: 6: /var/lib/dpkg/info/apturl.postinst: py3compile: not found
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 127
Preparing to unpack .../apturl-common_0.5.2ubuntu11.2_amd64.deb ...
/var/lib/dpkg/info/apturl-common.prerm: 6: /var/lib/dpkg/info/apturl-common.prerm: py3clean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/apturl-common_0.5.2ubuntu11.2_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/apturl-common.postinst: 27: /var/lib/dpkg/info/apturl-common.postinst: py3compile: not found
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
 /var/cache/apt/archives/update-manager_1%3a16.04.15_all.deb
 /var/cache/apt/archives/apturl_0.5.2ubuntu11.2_amd64.deb
 /var/cache/apt/archives/apturl-common_0.5.2ubuntu11.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

当 apt-get 和 dpkg 依赖于 python3 安装时,我该如何修复系统上损坏的 python3 安装?

提前致谢!

答案1

正是出于这个原因,我们通常建议不要更改已安装的 Python3 版本。

当人们想要使用多个版本或更新版本的 Python 时,我们建议使用隔离方法(如虚拟机、容器、python(3)-virtualenv 或 chroot)来防止系统损坏。Ubuntu 存储库中没有其他方法 - 我们不提供对这些方法的支持。

修复系统是有可能的,但可能不值得。许多依赖项可能缺失。dpkg 不依赖于 Python3,但 apt 肯定依赖于 Python3。基本策略是使用 dpkg 重新安装 apt 所需的缺失软件包。

访问http://packages.ubuntu.com,并下载python-minimalpython3-minimalapt软件包,然后使用 dpkg 安装这些软件包。这可能需要几次迭代,因为 dpkg 会抱怨缺少其他依赖项,您必须按正确的顺序下载和安装这些依赖项。

一般来说,大多数 Python 损坏或丢失的用户会发现,只需备份数据并进行全新安装就会更快、更容易。

答案2

我迟到了,但我想补充我的答案,因为只有 2 个解决方案。

  1. 重新安装 ubunut
  2. 执行以下操作。

我也遇到过这种情况,我尝试删除一些文件,但错误地删除了 /usr/bin/pythonxx 中几乎所有的 python 文件。我无法安装或删除任何东西。

解决方案在任何其他机器上安装 python,例如 VPS apt install python python3 python-all python-minimal python3-minimal

一旦您在 VPS 或另一台 PC 上安装了 pythone。

cd /var/lib zip -r fix.zip dpkg

现在将此文件(从 VPS 下载)复制到您的系统的 /var/lib unzip fiz.zip 按 A 覆盖全部

现在在你的机器上 apt install python3-all python3-minimal --reinstall apt autoremove

固定的

相关内容