我在更新 Ubuntu 20.04 时遇到问题。当我单击“更新软件”时。我收到以下消息:
我遵循了这里的答案:dpkg 错误:“尝试覆盖文件,该文件也在……”
我尝试了一下sudo dpkg -P python3.10
并得到:
(Reading database ... 256018 files and directories currently installed.)
Removing python3.10 (3.10.4-1+focal2) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...
Processing triggers for desktop-file-utils (0.24-1ubuntu3) ...
Processing triggers for mime-support (3.64ubuntu1) ...
然后我尝试了一下sudo apt --fix-broken install
,我得到了
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
libfwupdplugin1 libpython3.10-minimal libpython3.10-stdlib
python3.10-minimal
Use 'sudo apt autoremove' to remove them.
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 89 not upgraded.
6 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 ... 256000 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.1
0.4-1+focal2_amd64.deb (--unpack):
trying to overwrite '/usr/lib/python3.10/typing.py', which is also in package l
ibpython3.10-stdlib: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
许多其他人也发现了类似的问题,见下文。有几个已发布的答案,我建议你参考升级 python3.10 时子进程 /usr/bin/dpkg 返回错误代码 (1)这是最近的事,显然很快就覆盖(并帮助)了很多用户。
您必须做一些这样的手工工作。可能需要进行细微的改动,请查看参考资料并发布反馈。
- 使用以下命令删除软件包
sudo apt remove libpython3.10-minimal libpython3.10-stdlib
- 使用 移动包信息
sudo mv /var/lib/dpkg/info/libpython3.10-stdlib:amd64.* /tmp
(你可以使用 检查是否存在ls -l /var/lib/dpkg/info | grep -i libpython3.10-stdlib
)。 同样适用于libpython3.10-minimal
。 - 用 重新安装
sudo apt --fix-broken install
。
有关的:
- https://stackoverflow.com/questions/71871921/no-way-to-update-python3-10-on-my-linux-mint-mate-20-3-una
- https://bugs.launchpad.net/ubuntu/+source/python3.9/+bug/1969191
- https://forum.zorin.com/t/python-dependency-errors/17812
- https://discuss.python.org/t/stuck-upgrading-parts-of-3-10-from-3-10-3-to-3-10-4/15183
- https://serveanswer.com/questions/unmet-dependencies-when-installing-pyqt5-on-ubuntu
答案2
此问题已修复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
希望这可以帮助。