以下软件包在安装 python3 时存在未满足的依赖关系

以下软件包在安装 python3 时存在未满足的依赖关系

我对 Ubuntu 不是很有经验,当我一年开始使用 Python 时,我假设我覆盖了一些重要的依赖项。

我尝试修复这些问题,但结果却变得更糟,现在我无法安装或使用对我的工作至关重要的 nodejs。

当我运行时sudo apt update出现以下错误

Get:34 http://nl.archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata [1.768 B]
Fetched 6.700 kB in 5s (1.312 kB/s)                        
Traceback (most recent call last):
  File "/usr/lib/cnf-update-db", line 8, in <module>
from CommandNotFound.db.creator import DbCreator
  File "/usr/lib/python3/dist-packages/CommandNotFound/db/creator.py", line 11, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/lib/command-not-found/ -a -e /usr/lib/cnf-update-db; then /usr/lib/cnf-update-db > /dev/null; fi'
E: Sub-process returned an error code

当我运行时sudo apt --fix-broken install出现以下错误

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... failed.
The following packages have unmet dependencies:
 gir1.2-gtk-3.0 : Depends: gir1.2-gdkpixbuf-2.0 (>= 2.40.0) but 2.36.11-2 is installed
              Depends: gir1.2-pango-1.0 (>= 1.41.0) but 1.40.14-1ubuntu0.1 is installed
              Depends: libgtk-3-0 (>= 3.24.7) but 3.22.30-1ubuntu4 is installed
 python3-cairo : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is installed
 python3-gi : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is installed
          Depends: libgirepository-1.0-1 (>= 1.62.0-4~) but 1.56.1-1 is installed
 python3-gi-cairo : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is installed
 python3-markupsafe : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is installed
 python3-netifaces : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is installed
 python3-protobuf : Depends: libprotobuf17 but it is not installed
                Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is installed
 python3-reportlab-accel : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is installed
 python3-sip : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is installed
 python3-zope.interface : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
E: Unable to correct dependencies

在出现这种情况之前,我发现我有大约 1600 个过期的软件包。我知道这不是一个容易解决的问题,但如果能得到任何帮助,我将不胜感激。

尝试安装时aptitude

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 aptitude : Depends: aptitude-common (= 0.8.12-1ubuntu4) but it is not going to be installed
        Depends: libapt-pkg6.0 (>= 1.9.11~) but it is not going to be installed
        Depends: libboost-iostreams1.71.0 but it is not going to be installed
        Depends: libcwidget4 (>= 0.5.18-1) but it is not going to be installed
        Depends: libncursesw6 (>= 6.1+20180210) but it is not going to be installed
        Depends: libxapian30 (>= 1.4.14~) but 1.4.5-1ubuntu0.1 is to be installed
 gir1.2-gtk-3.0 : Depends: gir1.2-gdkpixbuf-2.0 (>= 2.40.0) but 2.36.11-2 is to be installed
              Depends: gir1.2-pango-1.0 (>= 1.41.0) but 1.40.14-1ubuntu0.1 is to be installed
              Depends: libgtk-3-0 (>= 3.24.7) but 3.22.30-1ubuntu4 is to be installed
 python3-cairo : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed
 python3-gi : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed
          Depends: libgirepository-1.0-1 (>= 1.62.0-4~) but 1.56.1-1 is to be installed
 python3-gi-cairo : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed
 python3-markupsafe : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed
 python3-netifaces : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed
 python3-protobuf : Depends: libprotobuf17 but it is not going to be installed
                Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed
 python3-reportlab-accel : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed
 python3-sip : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed
 python3-zope.interface : Depends: python3 (>= 3.8~) but 3.6.7-1~18.04 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

答案1

您有一行写着ModuleNotFoundError: No module named 'apt_pkg'。您可以尝试使用解决方案这个问题

处理未满足的依赖关系的另一种方法是使用aptitudeaptitude可以提出建议来解决根本问题。

sudo apt install aptitude
sudo aptitude update

相关内容