包装系统已损坏。--fix-broken 无法解决问题

包装系统已损坏。--fix-broken 无法解决问题

在 Ubuntu 21.04 上

在系统升级期间,我在编辑器中打开了一个配置文件,在此期间编辑器崩溃了,进而导致 apt 在升级过程中崩溃。

现在,当我重新运行时sudo apt-get upgrade,我收到大量与缺少 python 3.9 相关的错误并建议运行apt --fix-broken install

Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies.
 blueman : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
           Depends: gir1.2-ayatanaappindicator3-0.1 but it is not installed
 libboost-mpi-python1.71.0 : Depends: libboost-python1.71.0-py39
                             Depends: libopenmpi3 (>= 4.0.5) but 4.0.3-0ubuntu1 is installed
                             Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 libpython3-dev : Depends: libpython3.9-dev (>= 3.9.4-0~) but it is not installed
 python-typing : Depends: python2:any (< 2.8)
                 Depends: python2:any (>= 2.7~)
 python3-apt : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-dev : Depends: libpython3-dev (= 3.8.2-0ubuntu2) but 3.9.4-1 is installed
 python3-geoip : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-gi : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-gi-cairo : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-icu : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-kiwisolver : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-libtorrent : Depends: libtorrent-rasterbar10 (= 1.2.9-0.2fakesync1build1) but it is not installed
                      Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-markupsafe : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-matplotlib : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-netifaces : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-numpy : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-pil : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-pil.imagetk : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-pivy : Depends: libsoqt520 (>= 1.6.0+ds1) but 1.6.0~ea5cd76+ds1-1ubuntu2 is installed
                Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-protobuf : Depends: libprotobuf23 (>= 3.12.4) but it is not installed
                    Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-psutil : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-pygame : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-pyside2.qtcore : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
                          Depends: libpyside2-py3-5.15 (>= 5.15.2) but it is not installed
                          Depends: libqt5core5a (>= 5.15.1) but 5.12.8+dfsg-0ubuntu1 is installed
                          Depends: libshiboken2-py3-5.15 (>= 5.15.2) but it is not installed
 python3-pyside2.qtgui : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
                         Depends: libpyside2-py3-5.15 (>= 5.15.2) but it is not installed
                         Depends: libqt5core5a (>= 5.15.1) but 5.12.8+dfsg-0ubuntu1 is installed
                         Depends: libqt5gui5 (>= 5.15) but 5.12.8+dfsg-0ubuntu1 is installed
                         Depends: libqt5gui5 (>= 5.15.1) but 5.12.8+dfsg-0ubuntu1 is installed or
                                  libqt5gui5-gles (>= 5.15.1) but it is not installed
                         Depends: libshiboken2-py3-5.15 (>= 5.15.2) but it is not installed
 python3-pyside2.qtopengl : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
                            Depends: libpyside2-py3-5.15 (>= 5.15.2) but it is not installed
                            Depends: libqt5core5a (>= 5.15) but 5.12.8+dfsg-0ubuntu1 is installed
                            Depends: libqt5gui5 (>= 5.15) but 5.12.8+dfsg-0ubuntu1 is installed or
                                     libqt5gui5-gles (>= 5.15) but it is not installed
                            Depends: libqt5opengl5 (>= 5.15) but 5.12.8+dfsg-0ubuntu1 is installed
                            Depends: libqt5widgets5 (>= 5.15) but 5.12.8+dfsg-0ubuntu1 is installed
                            Depends: libshiboken2-py3-5.15 (>= 5.15.2) but it is not installed
 python3-pyside2.qtsvg : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
                         Depends: libpyside2-py3-5.15 (>= 5.15.2) but it is not installed
                         Depends: libqt5core5a (>= 5.15) but 5.12.8+dfsg-0ubuntu1 is installed
                         Depends: libqt5gui5 (>= 5.15) but 5.12.8+dfsg-0ubuntu1 is installed or
                                  libqt5gui5-gles (>= 5.15) but it is not installed
                         Depends: libqt5svg5 (>= 5.15.1) but 5.12.8-0ubuntu1 is installed
                         Depends: libqt5widgets5 (>= 5.15) but 5.12.8+dfsg-0ubuntu1 is installed
                         Depends: libshiboken2-py3-5.15 (>= 5.15.2) but it is not installed
 python3-pyside2.qtuitools : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
                             Depends: libpyside2-py3-5.15 (>= 5.15.2) but it is not installed
                             Depends: libqt5core5a (>= 5.15.1) but 5.12.8+dfsg-0ubuntu1 is installed
                             Depends: libqt5gui5 (>= 5.15) but 5.12.8+dfsg-0ubuntu1 is installed or
                                      libqt5gui5-gles (>= 5.15) but it is not installed
                             Depends: libqt5widgets5 (>= 5.15) but 5.12.8+dfsg-0ubuntu1 is installed
                             Depends: libshiboken2-py3-5.15 (>= 5.15.2) but it is not installed
 python3-pyside2.qtwidgets : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
                             Depends: libpyside2-py3-5.15 (>= 5.15.2) but it is not installed
                             Depends: libqt5core5a (>= 5.15) but 5.12.8+dfsg-0ubuntu1 is installed
                             Depends: libqt5gui5 (>= 5.15) but 5.12.8+dfsg-0ubuntu1 is installed or
                                      libqt5gui5-gles (>= 5.15) but it is not installed
                             Depends: libqt5widgets5 (>= 5.15.1) but 5.12.8+dfsg-0ubuntu1 is installed
                             Depends: libshiboken2-py3-5.15 (>= 5.15.2) but it is not installed
 python3-pyside2.qtxml : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
                         Depends: libpyside2-py3-5.15 (>= 5.15.2) but it is not installed
                         Depends: libqt5core5a (>= 5.15) but 5.12.8+dfsg-0ubuntu1 is installed
                         Depends: libqt5xml5 (>= 5.15.1) but 5.12.8+dfsg-0ubuntu1 is installed
                         Depends: libshiboken2-py3-5.15 (>= 5.15.2) but it is not installed
 python3-rencode : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-renderpm : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-reportlab-accel : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-setproctitle : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-simplejson : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-stl : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-systemd : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-talloc : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
                  Depends: libpython3.9 (>= 3.9.1) but it is not installed
 python3-twisted-bin : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-uno : Depends: libreoffice-common (>= 1:7.0.0~alpha~) but 1:6.4.7-0ubuntu0.20.04.1 is installed
               Depends: libreoffice-core (= 1:7.1.2~rc2-0ubuntu2) but 1:6.4.7-0ubuntu0.20.04.1 is installed or
                        libreoffice-core-nogui (= 1:7.1.2~rc2-0ubuntu2) but it is not installed
               Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
               Depends: libpython3.9 (>= 3.9.1) but it is not installed
 python3-yaml : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-zope.hookable : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3-zope.interface : Depends: python3 (>= 3.9~) but 3.8.2-0ubuntu2 is installed
 python3.9 : Depends: libpython3.9-stdlib (= 3.9.7-1+focal1) but it is not installed
 python3.9-dev : Depends: libpython3.9-dev (= 3.9.7-1+focal1) but it is not installed
                 Depends: libpython3.9 (= 3.9.7-1+focal1) but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution)

但是当我运行时apt --fix-broken install,安装 python3.9-minimal 时会出现错误:

Setting up python3.9-minimal (3.9.7-1+focal1) ...
Traceback (most recent call last):
  File "/usr/lib/python3.9/py_compile.py", line 9, in <module>
    import importlib.util
  File "/usr/lib/python3.9/importlib/util.py", line 2, in <module>
    from . import abc
  File "/usr/lib/python3.9/importlib/abc.py", line 17, in <module>
    from typing import Protocol, runtime_checkable
ModuleNotFoundError: No module named 'typing'
dpkg: error processing package python3.9-minimal (--configure):
 installed python3.9-minimal package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 python3.9-minimal
E: Sub-process /usr/bin/dpkg returned an error code (1)

我曾尝试使用手动安装 ubuntu python 打字包(python-typing_3.6.6-2_all)和 python 3.9(python3.9_3.9.4-1_amd64.deb)pdkg -i,但在前一种情况下出现与未满足的依赖项相关的错误:

(Reading database ... 489468 files and directories currently installed.)
Preparing to unpack python-typing_3.6.6-2_all.deb ...
Unpacking python-typing (3.6.6-2) over (3.6.6-2) ...
dpkg: dependency problems prevent configuration of python-typing:
 python-typing depends on python2:any (<< 2.8).
 python-typing depends on python2:any (>= 2.7~).

dpkg: error processing package python-typing (--install):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python-typing

后者:

(Reading database ... 489468 files and directories currently installed.)
Preparing to unpack python3.9_3.9.4-1_amd64.deb ...
Unpacking python3.9 (3.9.4-1) over (3.9.7-1+focal1) ...
dpkg: dependency problems prevent configuration of python3.9:
 python3.9 depends on python3.9-minimal (= 3.9.4-1); however:
  Version of python3.9-minimal on system is 3.9.7-1+focal1.
 python3.9 depends on libpython3.9-stdlib (= 3.9.4-1); however:
  Package libpython3.9-stdlib is not installed.

dpkg: error processing package python3.9 (--install):
 dependency problems - leaving unconfigured
Processing triggers for desktop-file-utils (0.26-1ubuntu1) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for man-db (2.9.1-1) ...
Errors were encountered while processing:
 python3.9

我也尝试过使用 pip 安装这些包,但没有成功。

相关内容