在将 Python 更新到版本 3.9 并使用命令“python”调用 Python 3.9(更新替代品)或其他操作之后,我遇到了一个全局问题,每次更新/安装/重新安装等都是:
Setting up python-wheel (0.29.0-2) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in <module>
from debpython.version import SUPPORTED, debsorted, vrepr, \
ModuleNotFoundError: No module named 'debpython'
dpkg: error processing package python-wheel (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up python-pkg-resources (33.1.1-1) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in <module>
from debpython.version import SUPPORTED, debsorted, vrepr, \
ModuleNotFoundError: No module named 'debpython'
dpkg: error processing package python-pkg-resources (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up python-pip (18.1-5) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in <module>
from debpython.version import SUPPORTED, debsorted, vrepr, \
ModuleNotFoundError: No module named 'debpython'
dpkg: error processing package python-pip (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up python-xdg (0.25-4+deb9u1) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in <module>
from debpython.version import SUPPORTED, debsorted, vrepr, \
ModuleNotFoundError: No module named 'debpython'
dpkg: error processing package python-xdg (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python-setuptools:
python-setuptools depends on python-pkg-resources (= 33.1.1-1); however:
Package python-pkg-resources is not configured yet.
dpkg: error processing package python-setuptools (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
python-wheel
python-pkg-resources
python-pip
python-xdg
python-setuptools
我可以安装或卸载软件包、更新或执行其他操作。然而,我的所有脚本都停止工作了。不幸的是,我在互联网上找不到解决我的问题的方法。我已经尝试了所有我能找到的关于我的问题的方法。
答案1
Debian 9 预计python
将成为 Python 2 解释器的链接;正如您所发现的,您无法在不破坏系统部分的情况下更改它(如果您安装了 Python 2 模块)。
你需要撤消你所做的一切update-alternatives
——许多网站建议在 Python 安装中使用它,但 Debian 中的 Python 包不使用update-alternatives
——并恢复python
符号链接:
sudo apt-get install --reinstall python
如果您可以升级到 Debian 11,则会获得 Debian Python 3.9 软件包(以及受支持的版本)。