我该如何解决这个破损包装问题?

我该如何解决这个破损包装问题?
krishna@Krishna-PC:~$ sudo dpkg --configure -a
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
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
Errors were encountered while processing:
 python3.10
 python3.10-minimal

当我尝试“SUDO APT --FIX-BROKEN INSTALL”时

$ 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 11 not upgraded.
2 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 ... 204340 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 als
o 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-stdli
b:amd64 3.10.4-1+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)

答案1

一个粗暴的解决方案是强制覆盖。

sudo apt --fix-broken -o DPkg::Options::=--force-overwrite install

与@Whippy 的答案类似,但您不需要查找和指定 debs。

答案2

我刚刚遇到了同样的问题。答案在@karel提供的链接中,但我采取的具体步骤是:

~ $ sudo dpkg -i --force-overwrite /var/cache/apt/archives/libpython3.10-minimal_3.10.4-1+focal2_amd64.deb

这会将覆盖错误简化为警告并完成包的安装。

此后,您可以执行“sudo apt --fix-broken install”来成功完成升级。

答案3

此问题已修复Deadsnakes PPA 的 github

sudo apt --fix-missing purge $(dpkg -l | grep 'python3\.10' | awk '{print $2}')

或者

sudo apt purge libpython3.10-minimal libpython3.10-stdlib libpython3.10 libpython3.10-dev python3.10 python3.10-minimal python3.10-dev python3.10-venv
sudo apt install python3.10

希望这可以帮助。

相关内容