在我安装了 python3.11 和 3.11-venv(已经有 3.10)之后,每当我尝试 apt 升级时,我都会收到此消息(翻译)
python3-dev: Depends: python3 (= 3.10.6-1~22.04) aber 3.10.6-1~22.04 is already installed
Depends: libpython3-dev (= 3.10.6-1~22.04) aber 3.10.6-1~22.04 is already installed
Depends: libjs-sphinxdoc (>= 4.3) aber 4.3.2-1 is already installed
我再也无法做任何事情,我甚至再次尝试删除 3.11,但我收到的只是一条消息,提示我使用apt --fix-broken install
如果我这样做,我就会得到(翻译)
Unpacking of python3-distutils (3.10.6-1~22.04) over (3.10.4-0ubuntu1) ...
dpkg: Error while editing the archive /var/cache/apt/archives/python3-distutils_3.10.6-1~22.04_all.deb (--unpack):
Tried overwriting »/usr/lib/python3.11/distutils/README«, which is also in package python3.11-distutils 3.11.0~rc2-1+jammy1
Preparing unpacking of .../python3-lib2to3_3.10.6-1~22.04_all.deb ...
Unpacking of python3-lib2to3 (3.10.6-1~22.04) over (3.10.4-0ubuntu1) ...
dpkg: Error while editing the archive /var/cache/apt/archives/python3-lib2to3_3.10.6-1~22.04_all.deb (--unpack):
Tried overwriting »/usr/lib/python3.11/lib2to3/Grammar.txt«, which is also in package python3.11-lib2to3 3.11.0~rc2-1+jammy1
Error while editing:
/var/cache/apt/archives/python3-distutils_3.10.6-1~22.04_all.deb
/var/cache/apt/archives/python3-lib2to3_3.10.6-1~22.04_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
此时此刻,我只想让一切恢复正常,即使我必须删除 python3.11。有没有办法,例如使用 dpkg 来实现这一点?请帮忙
答案1
嗯,我遇到了同样的问题,所以我做了
sudo dpkg -r python3.11-distutils python3.11-lib2to3 python3.11-venv
在那之后
apt --fix-broken install
并且成功了