我的 Python 在 ubuntu 上运行得很好……直到今天我接受了 ubuntu 软件包更新。从那时起,我的 Python 3.6 就坏了,我无法再次安装它。我试过卸载它,但无法重新安装它。我正在尝试
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.6
尝试安装后,我看到了
The following additional packages will be installed:
libpython3.6-minimal libpython3.6-stdlib python3.6-minimal
Suggested packages:
python3.6-venv python3.6-doc binfmt-support
The following NEW packages will be installed:
libpython3.6-minimal libpython3.6-stdlib python3.6 python3.6-minimal
并以这个错误结束:
Selecting previously unselected package libpython3.6-minimal:amd64.
(Reading database ... 332625 files and directories currently installed.)
Preparing to unpack .../libpython3.6-minimal_3.6.5-1+xenial1_amd64.deb ...
Unpacking libpython3.6-minimal:amd64 (3.6.5-1+xenial1) ...
Selecting previously unselected package python3.6-minimal.
Preparing to unpack .../python3.6-minimal_3.6.5-1+xenial1_amd64.deb ...
Unpacking python3.6-minimal (3.6.5-1+xenial1) ...
Preparing to unpack .../libpython3.6-stdlib_3.6.5-1+xenial1_amd64.deb ...
Unpacking libpython3.6-stdlib:amd64 (3.6.5-1+xenial1) ...
dpkg: error processing archive /var/cache/apt/archives/libpython3.6-
stdlib_3.6.5-1+xenial1_amd64.deb (--unpack):
trying to overwrite '/usr/lib/python3.6/tkinter/__main__.py', which is
also in package python3-tk:amd64 3.6.5-3~16.04.york0.2
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Selecting previously unselected package python3.6.
Preparing to unpack .../python3.6_3.6.5-1+xenial1_amd64.deb ...
Unpacking python3.6 (3.6.5-1+xenial1) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for gnome-menus (3.13.3-6ubuntu3.1) ...
Processing triggers for desktop-file-utils (0.22-1ubuntu5.1) ...
Processing triggers for mime-support (3.59ubuntu1) ...
Errors were encountered while processing:
/var/cache/apt/archives/libpython3.6-stdlib_3.6.5-1+xenial1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
我似乎无法安装。有人能解决这个问题吗?真的不想重新安装 ubuntu
答案1
我通过删除 python3-tk(来自 jonathonf ppa 的“旧”python3.6 包)解决了这个问题(也是由于将 python3.6 的 ppa 从 jonathonf 更改为 deadsnakes 造成的)。
sudo apt remove python3-tk
另外我不确定它是否有帮助,但我/usr/lib/python3.6/
删除后清理了(python3.6,python3.6-minimal,libpython3.6-stdlib 和 apt autoremove)