我跑了sudo apt update
又跑,sudo apt upgrade
结果如下:
(.default) saul@linuxBox:~$ sudo apt upgrade
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:
libpython3.10 : Depends: libpython3.10-stdlib (= 3.10.4-1+focal2) but 3.10.4-1+focal1 is installed
libpython3.10-dev : Depends: libpython3.10-stdlib (= 3.10.4-1+focal2) but 3.10.4-1+focal1 is installed
python3.10 : Depends: libpython3.10-stdlib (= 3.10.4-1+focal2) but 3.10.4-1+focal1 is installed
python3.10-minimal : Depends: libpython3.10-minimal (= 3.10.4-1+focal2) but 3.10.4-1+focal1 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
我尝试了这个建议:
(.default) saul@linuxBox:~$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
libpython3.10-minimal libpython3.10-stdlib
The following packages will be upgraded:
libpython3.10-minimal libpython3.10-stdlib
2 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
18 not fully installed or removed.
Need to get 0 B/2,566 kB of archives.
After this operation, 68.6 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 220160 files and directories currently installed.)
Preparing to unpack .../libpython3.10-stdlib_3.10.4-1+focal2_amd64.deb ...
Unpacking libpython3.10-stdlib:amd64 (3.10.4-1+focal2) over (3.10.4-1+focal1) ...
dpkg: error processing archive /var/cache/apt/archives/libpython3.10-stdlib_3.10.4-1+focal2_amd64.deb (--unpack):
trying to overwrite '/usr/lib/python3.10/_sysconfigdata__linux_x86_64-linux-gnu.py', which is also in package libpython3.10-minimal:amd64 3.10.4-1
+focal1
Preparing to unpack .../libpython3.10-minimal_3.10.4-1+focal2_amd64.deb ...
Unpacking libpython3.10-minimal:amd64 (3.10.4-1+focal2) over (3.10.4-1+focal1) ...
dpkg: error processing archive /var/cache/apt/archives/libpython3.10-minimal_3.10.4-1+focal2_amd64.deb (--unpack):
trying to overwrite '/usr/lib/python3.10/typing.py', which is also in package libpython3.10-stdlib:amd64 3.10.4-1+`enter code here`focal1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/libpython3.10-stdlib_3.10.4-1+focal2_amd64.deb
/var/cache/apt/archives/libpython3.10-minimal_3.10.4-1+focal2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
正如接受的答案所建议的那样这里先运行sudo apt autoclean
然后重试sudo apt --fix-broken
,但我得到了相同的结果。正如链接中所说,我运行了sudo dpkg --configure -a
它,得到了大量的输出,结尾是
Errors were encountered while processing:
libpython3.10:amd64
python3.10
python3.10-minimal
python3.10-tk:amd64
libpython3.10-dev:amd64
python3.10-dev
python3.10-venv
链接没有建议在这种情况下该怎么做,我不知所措。我曾几次不小心使用了sudo pip install
而不是 ,并在命令运行后收到警告。我该怎么做才能解决这个问题?pip install
如果有关系的话,这里是整个输出sudo dpkg --configure -a
:
(.default) saul@linuxBox:~$ sudo dpkg --configure -a
dpkg: dependency problems prevent configuration of libpython3.10:amd64:
libpython3.10:amd64 depends on libpython3.10-stdlib (= 3.10.4-1+focal2); however:
Version of libpython3.10-stdlib:amd64 on system is 3.10.4-1+focal1.
dpkg: error processing package libpython3.10:amd64 (--configure):
dependency problems - leaving unconfigured
Setting up systemd-sysv (245.4-4ubuntu3.16) ...
dpkg: dependency problems prevent configuration of python3.10:
python3.10 depends on libpython3.10-stdlib (= 3.10.4-1+focal2); however:
Version of libpython3.10-stdlib:amd64 on system is 3.10.4-1+focal1.
dpkg: error processing package python3.10 (--configure):
dependency problems - leaving unconfigured
Setting up python3-problem-report (2.20.11-0ubuntu27.23) ...
Setting up python3.10-lib2to3 (3.10.4-1+focal2) ...
Setting up libnss-systemd:amd64 (245.4-4ubuntu3.16) ...
dpkg: dependency problems prevent configuration of python3.10-minimal:
python3.10-minimal depends on libpython3.10-minimal (= 3.10.4-1+focal2); however:
Version of libpython3.10-minimal:amd64 on system is 3.10.4-1+focal1.
dpkg: error processing package python3.10-minimal (--configure):
dependency problems - leaving unconfigured
Setting up python3-apport (2.20.11-0ubuntu27.23) ...
dpkg: dependency problems prevent configuration of python3.10-tk:amd64:
python3.10-tk:amd64 depends on python3.10; however:
Package python3.10 is not configured yet.
dpkg: error processing package python3.10-tk:amd64 (--configure):
dependency problems - leaving unconfigured
Setting up udev (245.4-4ubuntu3.16) ...
update-initramfs: deferring update (trigger activated)
dpkg: dependency problems prevent configuration of libpython3.10-dev:amd64:
libpython3.10-dev:amd64 depends on libpython3.10-stdlib (= 3.10.4-1+focal2); however:
Version of libpython3.10-stdlib:amd64 on system is 3.10.4-1+focal1.
libpython3.10-dev:amd64 depends on libpython3.10 (= 3.10.4-1+focal2); however:
Package libpython3.10:amd64 is not configured yet.
dpkg: error processing package libpython3.10-dev:amd64 (--configure):
dependency problems - leaving unconfigured
Setting up python3.10-distutils (3.10.4-1+focal2) ...
dpkg: dependency problems prevent configuration of python3.10-dev:
python3.10-dev depends on python3.10 (= 3.10.4-1+focal2); however:
Package python3.10 is not configured yet.
python3.10-dev depends on libpython3.10-dev (= 3.10.4-1+focal2); however:
Package libpython3.10-dev:amd64 is not configured yet.
python3.10-dev depends on libpython3.10 (= 3.10.4-1+focal2); however:
Package libpython3.10:amd64 is not configured yet.
dpkg: error processing package python3.10-dev (--configure):
dependency problems - leaving unconfigured
Setting up brave-browser (1.37.116) ...
Setting up libpam-systemd:amd64 (245.4-4ubuntu3.16) ...
dpkg: dependency problems prevent configuration of python3.10-venv:
python3.10-venv depends on python3.10 (= 3.10.4-1+focal2); however:
Package python3.10 is not configured yet.
dpkg: error processing package python3.10-venv (--configure):
dependency problems - leaving unconfigured
Setting up apport (2.20.11-0ubuntu27.23) ...
apport-autoreport.service is a disabled or a static unit, not starting it.
Setting up apport-gtk (2.20.11-0ubuntu27.23) ...
Processing triggers for mime-support (3.64ubuntu1) ...
Processing triggers for hicolor-icon-theme (0.17-2) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for libc-bin (2.31-0ubuntu9.7) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for dbus (1.12.16-2ubuntu2.1) ...
Processing triggers for desktop-file-utils (0.24-1ubuntu3) ...
Processing triggers for initramfs-tools (0.136ubuntu6.7) ...
update-initramfs: Generating /boot/initrd.img-5.13.0-39-generic
Errors were encountered while processing:
libpython3.10:amd64
python3.10
python3.10-minimal
python3.10-tk:amd64
libpython3.10-dev:amd64
python3.10-dev
python3.10-venv