You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 22.04.2中python3配置失败及依赖问题求助

Ubuntu 22.04.2中python3配置失败及依赖问题求助

我最近重启系统后,运行sudo apt upgrade就一直碰到依赖问题,折腾了好久都没彻底解决。之前我把/usr/bin里的Python符号链接改成指向python3.11了,当时没出问题,但现在怀疑是不是这个操作留下了隐患——后来我重新安装了3.10和3.11版本,把符号链接也恢复了,可问题还是存在。

错误现象

执行sudo apt upgrade或者sudo apt --fix-broken install时,都会输出以下错误信息:

The following packages were automatically installed and are no longer required:

libapparmor1 libargon2-1 libcryptsetup12 libdevmapper1.02.1 libip4tc2 libjson-c5 libkmod2 systemd

Use 'sudo apt autoremove' to remove them.

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

13 not fully installed or removed.

After this operation, 0 B of additional disk space will be used.

Setting up python3 (3.10.6-1~22.04) ...

running python rtupdate hooks for python3.10...

dpkg-query: package 'ibus-table' is not installed

Use dpkg --contents (= dpkg-deb --contents) to list archive files contents.

Traceback (most recent call last):

File "/usr/bin/py3clean", line 210, in <module>

main()

File "/usr/bin/py3clean", line 196, in main

pfiles = set(dpf.from_package(options.package))

File "/usr/share/python3/debpython/files.py", line 53, in from_package

raise Exception("cannot get content of %s" % package_name)

Exception: cannot get content of ibus-table

error running python rtupdate hook ibus-table

dpkg-query: package 'ibus' is not installed

Use dpkg --contents (= dpkg-deb --contents) to list archive files contents.

Traceback (most recent call last):

File "/usr/bin/py3clean", line 210, in <module>

main()

File "/usr/bin/py3clean", line 196, in main

pfiles = set(dpf.from_package(options.package))

File "/usr/share/python3/debpython/files.py", line 53, in from_package

raise Exception("cannot get content of %s" % package_name)

Exception: cannot get content of ibus

error running python rtupdate hook ibus

dpkg-query: package 'python3-uno' is not installed

Use dpkg --contents (= dpkg-deb --contents) to list archive files contents.

Traceback (most recent call last):

File "/usr/bin/py3clean", line 210, in <module>

main()

File "/usr/bin/py3clean", line 196, in main

pfiles = set(dpf.from_package(options.package))

File "/usr/share/python3/debpython/files.py", line 53, in from_package

raise Exception("cannot get content of %s" % package_name)

Exception: cannot get content of python3-uno

error running python rtupdate hook python3-uno

dpkg-query: package 'system-config-printer-common' is not installed

Use dpkg --contents (= dpkg-deb --contents) to list archive files contents.

Traceback (most recent call last):

File "/usr/bin/py3clean", line 210, in <module>

main()

File "/usr/bin/py3clean", line 196, in main

pfiles = set(dpf.from_package(options.package))

File "/usr/share/python3/debpython/files.py", line 53, in from_package

raise Exception("cannot get content of %s" % package_name)

Exception: cannot get content of system-config-printer-common

error running python rtupdate hook system-config-printer-common

dpkg-query: package 'system-config-printer' is not installed

Use dpkg --contents (= dpkg-deb --contents) to list archive files contents.

Traceback (most recent call last):

File "/usr/bin/py3clean", line 210, in <module>

main()

File "/usr/bin/py3clean", line 196, in main

pfiles = set(dpf.from_package(options.package))

File "/usr/share/python3/debpython/files.py", line 53, in from_package

raise Exception("cannot get content of %s" % package_name)

Exception: cannot get content of system-config-printer

error running python rtupdate hook system-config-printer

dpkg: error processing package python3 (--configure):

installed python3 package post-installation script subprocess returned error exit status 4

Setting up systemd (249.11-0ubuntu3.9) ...

cp: '/etc/resolv.conf' and '/run/systemd/resolve/stub-resolv.conf' are the same file

dpkg: error processing package systemd (--configure):

installed systemd package post-installation script subprocess returned error exit status 1

dpkg: dependency problems prevent configuration of python3-wheel:

python3-wheel depends on python3:any; however:

Package python3 is not configured yet.

dpkg: error processing package python3-wheel (--configure):

dependency problems - leaving unconfigured

dpkg: dependency problems prevent configuration of python3-dev:

python3-dev depends on python3 (= 3.10.6-1~22.04); however:

Package python3 is not configured yet.

dpkg: error processing package python3-dev (--configure):

dependency problems - leaving unconfigured

dpkg: dependency problems prevent configuration of python3-pip:

python3-pip depends on python3-wheel; however:

Package python3-wheel is not configured yet.

python3-pip depends on python3:any; however:

Package python3 is not configured yet.

dpkg: error processing package python3-pip (--configure):

dependency problems - leaving unconfigured

dpkg: dependency problems prevent configuration of lsb-release:

lsb-release depends on python3:any; however:

Package python3 is not configured yet.

dpkg: error processing package lsb-release (--configure):

dependency problems - leaving unconfigured

dpkg: dependency problems prevent configuration of python3-lib2to3:

python3-lib2to3 depends on python3:any (>= 3.10.5-0~); however:

Package python3 is not configured yet.

python3-lib2to3 depends on python3:any (<< 3.12); however:

Package python3 is not configured yet.

dpkg: error processing package python3-lib2to3 (--configure):

dependency problems - leaving unconfigured

dpkg: dependency problems prevent configuration of python3-pkg-resources:

python3-pkg-resources depends on python3:any; however:

Package python3 is not configured yet.

dpkg: error processing package python3-pkg-resources (--configure):

dependency problems - leaving unconfigured

dpkg: dependency problems prevent configuration of python3-distutils:

python3-distutils depends on python3:any (>= 3.10.5-0~); however:

Package python3 is not configured yet.

python3-distutils depends on python3:any (<< 3.12); however:

Package python3 is not configured yet.

python3-distutils depends on python3-lib2to3 (= 3.10.6-1~22.04); however:

Package python3-lib2to3 is not configured yet.

dpkg: error processing package python3-distutils (--configure):

dependency problems - leaving unconfigured

dpkg: dependency problems prevent configuration of python3-setuptools:

python3-setuptools depends on python3-pkg-resources (= 59.6.0-1.2ubuntu0.22.04.1); however:

Package python3-pkg-resources is not configured yet.

python3-setuptools depends on python3-distutils; however:

Package python3-distutils is not configured yet.

python3-setuptools depends on python3:any; however:

Package python3 is not configured yet.

dpkg: error processing package python3-setuptools (--configure):

dependency problems - leaving unconfigured

dpkg: dependency problems prevent configuration of python3-distro:

python3-distro depends on lsb-release; however:

Package lsb-release is not configured yet.

python3-distro depends on python3:any; however:

Package python3 is not configured yet.

dpkg: error processing package python3-distro (--configure):

dependency problems - leaving unconfigured

dpkg: dependency problems prevent configuration of hplip-data:

hplip-data depends on python3-distro; however:

Package python3-distro is not configured yet.

hplip-data depends on python3:any; however:

Package python3 is not configured yet.

Package lsb-release is not configured yet.

python3-distro depends on python3:any; however:

Package python3 is not configured yet.

dpkg: error processing package python3-distro (--configure):

dependency problems - leaving unconfigured

dpkg: dependency problems prevent configuration of hplip-data:

hplip-data depends on python3-distro; however:

Package python3-distro is not configured yet.

hplip-data depends on python3:any; however:

Package python3 is not configured yet.

Package lsb-release is not configured yet.

python3-distro depends on python3:any; however:

Package python3 is not configured yet.

dpkg: error processing package python3-distro (--configure):

dependency problems - leaving unconfigured

dpkg: dependency problems prevent configuration of hplip-data:

hplip-data depends on python3-distro; however:

Package python3-distro is not configured yet.

hplip-data depends on python3:any; however:

Package lsb-release is not configured yet.

python3-distro depends on python3:any; however:

Package python3 is not configured yet.

dpkg: error processing package python3-distro (--configure):

dependency problems - leaving unconfigured

dpkg: dependency problems prevent configuration of hplip-data:

hplip-data depends on python3-distro; however:

Package python3-distro is not configured yet.

hplip-data depends on python3:any; however:

Package python3 is not configured yet.

dpkg: error processing package hplip-data (--configure):

dependency problems - leaving unconfigured

dpkg: dependency problems prevent configuration of python3-all:

python3-all depends on python3 (= 3.10.6-1~22.04); however:

Package python3 is not configured yet.

python3-all depends on python3-distutils (>= 3.10.6-1~); however:

Package python3-distutils is not configured yet.

dpkg: error processing package python3-all (--configure):

dependency problems - leaving unconfigured

Errors were encountered while processing:

python3

systemd

Package lsb-release is not configured yet.

python3-distro depends on python3:any; however:

Package python3 is not configured yet.

dpkg: error processing package python3-distro (--configure):

dependency problems - leaving unconfigured

dpkg: dependency problems prevent configuration of hplip-data:

hplip-data depends on python3-distro; however:

Package python3-distro is not configured yet.

hplip-data depends on python3:any; however:

Package python3 is not configured yet.

Package lsb-release is not configured yet.

python3-distro depends on python3:any; however:

Package python3 is not configured yet.

dpkg: error processing package python3-distro (--configure):

dependency problems - leaving unconfigured

dpkg: dependency problems prevent configuration of hplip-data:

hplip-data depends on python3-distro; however:

Package python3-distro is not configured yet.

hplip-data depends on python3:any; however:

Package python3 is not configured yet.

dpkg: error processing package hplip-data (--configure):

dependency problems - leaving unconfigured

dpkg: dependency problems prevent configuration of python3-all:

python3-all depends on python3 (= 3.10.6-1~22.04); however:

Package python3 is not configured yet.

python3-all depends on python3-distutils (>= 3.10.6-1~); however:

Package python3-distutils is not configured yet.

dpkg: error processing package python3-all (--configure):

dependency problems - leaving unconfigured

Errors were encountered while processing:

python3

systemd

python3-wheel

python3-dev

python3-pip

lsb-release

python3-lib2to3

python3-pkg-resources

python3-distutils

python3-setuptools

python3-distro

hplip-data

python3-all

E: Sub-process /usr/bin/dpkg returned an error code (1)

执行dpkg -l查看问题包状态,结果如下:

iF  python3                     3.10.6-1~22.04                          amd64        interactive high-level object-oriented language (default python3 ver>
iU  python3-all                 3.10.6-1~22.04                          amd64        package depending on all supported Python 3 runtime versions
iU  python3-dev                 3.10.6-1~22.04                          amd64        header files and a static library for Python (default)
iU  python3-distro              1.7.0-1                                 all          Linux OS platform information API
iU  python3-distutils           3.10.6-1~22.04                          all          distutils package for Python 3.x
iU  python3-lib2to3             3.10.6-1~22.04                          all          Interactive high-level object-oriented language (lib2to3)
ii  python3-minimal             3.10.6-1~22.04                          amd64        minimal subset of the Python language (default python3 version)
iU  python3-pip                 22.0.2+dfsg-1ubuntu0.3                  all          Python package installer
iU  python3-pkg-resources       59.6.0-1.2ubuntu0.22.04.1               all          Package Discovery and Resource Access using pkg_resources
iU  python3-setuptools          59.6.0-1.2ubuntu0.22.04.1               all          Python3 Distutils Enhancements
iU  python3-wheel               0.37.1-2ubuntu0.22.04.1                 all          built-package format for Python

另外systemd也显示为iF状态。

已尝试的解决方法

我试过以下几种操作,但都没彻底解决问题:

  • 执行sudo dpkg --configure python3和sudo dpkg --configure -a,依旧触发py3clean的错误,提示找不到ibus-table、ibus等未安装包的内容
  • 尝试安装ibus-table,结果出现类似依赖错误,还导致systemd变成了iF状态
  • 强制删除python3(sudo dpkg --remove --force-depends python3)后重新安装,问题依旧
  • 删除/etc/resolv.conf后运行sudo apt --fix-broken install,修复了部分包的问题,但python3的配置失败问题仍然存在

现在其他依赖包的问题都解决了,只剩python3无法完成配置,每次尝试都会触发那些py3clean的错误,有没有大佬能指点一下怎么解决这个问题?

备注:内容来源于stack exchange,提问作者shuggahswv

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.22 11:30:29