尝试升级 Python 后出现问题

尝试升级 Python 后出现问题

我仍然可以运行 Anaconda,但在意外创建错误的符号链接并尝试升级 Python 版本后,Python 安装在遇到一些问题

The following additional packages will be installed:
apport apport-gtk aptdaemon python3-apport python3-apt python3-aptdaemon python3-aptdaemon.gtk3widgets                  python3-distupgrade python3-software-properties python3-update-manager ubuntu-drivers-common                            ubuntu-release-upgrader-core ubuntu-release-upgrader-gtk unattended-upgrades update-manager-core update-notifier        update-notifier-common
Suggested packages:
x-terminal-emulator python3-launchpadlib python3-apt-dbg python-apt-doc python3-aptdaemon.pkcompat bsd-mailx            default-mta | mail-transport-agent needrestart
The following NEW packages will be installed:
apport apport-gtk aptdaemon python3-apport python3-apt python3-aptdaemon python3-aptdaemon.gtk3widgets                  python3-distupgrade python3-software-properties python3-update-manager ubuntu-release-upgrader-core                     ubuntu-release-upgrader-gtk unattended-upgrades update-manager-core update-notifier update-notifier-common            The following packages will be upgraded:                                                                                  ubuntu-drivers-common

...

Preparing to unpack .../00-python3-apt_1.6.5ubuntu0.5_amd64.deb ...
Unpacking python3-apt (1.6.5ubuntu0.5) ...
Preparing to unpack .../01-ubuntu-drivers-common_1%3a0.8.6.3~0.18.04.1_amd64.deb ...
File "/usr/bin/py3clean", line 4
SyntaxError: Non-ASCII character '\xc2' in file /usr/bin/py3clean on line 4, but no encoding declared;
see http://python.org/dev/peps/pep-0263/ for details
dpkg: error processing archive /tmp/apt-dpkg-install-UU4SRN/01-ubuntu-drivers-common_1%3a0.8.6.3~0.18.04.1_amd64.deb (--unpack):

new ubuntu-drivers-common package pre-removal script subprocess returned error exit status 1
File "/usr/bin/py3compile", line 4
SyntaxError: Non-ASCII character '\xc2' in file /usr/bin/py3compile on line 4, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
    
dpkg: error while cleaning up:
installed ubuntu-drivers-common package post-installation script subprocess returned error exit status 1

...

Errors were encountered while processing:
/tmp/apt-dpkg-install-UU4SRN/01-ubuntu-drivers-common_1%3a0.8.6.3~0.18.04.1_amd64.deb

既不能跑sudo dpkg --configure -a也不能sudo apt-get install -f

答案1

您的帖子细节有点少(您到底做了什么?为什么在描述中包含 anaconda?等等);但是,手动升级系统范围的 python 安装不是一个好主意,因为许多系统实用程序都依赖于正确的 python 版本。我强烈建议您恢复更改,如果需要更新的 python 版本,请构建一个python 虚拟环境。

01-ubuntu-drivers-common_1%3a0.8.6.3~0.18.04.1_amd64.deb话虽如此,我唯一能看到的问题是,由于安装脚本中出现意外字符,无法安装单个包 ( )。我们确定它依赖于 python 升级吗?如果是,为什么?

请恢复您的 Python 升级并重试。

相关内容