我使用的是 ubuntu 14.04,但 Python 搞砸了。首先,我安装了 Python 3.6.8,但遇到了一些问题,所以我换到了 Python 3.6.1。调用 3.6.1 版本的唯一方法是使用 Python3.6,但我需要使用 Python 才能使其工作。当我尝试使用别名时,它有点工作,但不是在所有地方都工作。我想安装 ffmpeg,但当我使用时:
sudo add-apt-repository ppa:mc3man/trusty-media
我收到一条错误消息
Traceback (most recent call last):
File "/usr/bin/add-apt-repository", line 11, in <module>
from softwareproperties.SoftwareProperties import SoftwareProperties, shortcut_handler
File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 27, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
然后,当我尝试用
apt-get install python-apt
我收到另一个错误
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-apt is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
16 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up lsb-release (4.1+Debian11ubuntu6.2) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in <module>
from debpython.version import SUPPORTED, debsorted, vrepr, \
File "/usr/share/python/debpython/version.py", line 24, in <module>
from ConfigParser import SafeConfigParser
ModuleNotFoundError: No module named 'ConfigParser'
dpkg: error processing package lsb-release (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up python-apt (0.9.3.5ubuntu3) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in <module>
from debpython.version import SUPPORTED, debsorted, vrepr, \
File "/usr/share/python/debpython/version.py", line 24, in <module>
from ConfigParser import SafeConfigParser
ModuleNotFoundError: No module named 'ConfigParser'
dpkg: error processing package python-apt (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up python-chardet (2.0.1-2build2) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in <module>
from debpython.version import SUPPORTED, debsorted, vrepr, \
File "/usr/share/python/debpython/version.py", line 24, in <module>
from ConfigParser import SafeConfigParser
ModuleNotFoundError: No module named 'ConfigParser'
dpkg: error processing package python-chardet (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up python-colorama (0.2.5-0.1ubuntu2) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in <module>
from debpython.version import SUPPORTED, debsorted, vrepr, \
File "/usr/share/python/debpython/version.py", line 24, in <module>
from ConfigParser import SafeConfigParser
ModuleNotFoundError: No module named 'ConfigParser'
dpkg: error processing package python-colorama (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up python-distlib (0.1.8-1ubuntu1) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in <module>
from debpython.version import SUPPORTED, debsorted, vrepr, \
File "/usr/share/python/debpython/version.py", line 24, in <module>
from ConfigParser import SafeConfigParser
ModuleNotFoundError: No module named 'ConfigParser'
dpkg: error processing package python-distlib (--configure):
subprocess installed post-installation script returned error exit status 1
Setting up python-six (1.5.2-1ubuntu1.1) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in <module>
from debpython.version import SUPPORTED, debsorted, vrepr, \
File "/usr/share/python/debpython/version.py", line 24, in <module>
from ConfigParser import SafeConfigParser
ModuleNotFoundError: No module named 'ConfigParser'
dpkg: error processing package python-six (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python-html5lib:
python-html5lib depends on python-six; however:
Package python-six is not configured yet.
dpkg: error processing package python-html5lib (--configure):
dependency problems - leaving unconfigured
Setting up python-pkg-resources (3.3-1ubuntu2) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in <module>
from debpython.version import SUPPORTED, debsorted, vrepr, \
File "/usr/share/python/debpython/version.py", line 24, in <module>
from ConfigParser import SafeConfigParser
ModuleNotFoundError: No module named 'ConfigParser'
dpkg: error processing package python-pkg-resources (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python-urllib3:
python-urllib3 depends on python-six; however:
Package python-six is not configured yet.
dpkg: error processing package python-urllib3 (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-requests:
python-requests depends on python-chardet; however:
Package python-chardet is not configured yet.
python-requests depends on python-urllib3 (>= 1.7.1); however:
Package python-urllib3 is not configured yet.
dpkg: error processing package python-requests (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-setuptools:
python-setuptools depends on python-pkg-resources (= 3.3-1ubuntu2); however:
Package python-pkg-resources is not configured yet.
dpkg: error processing package python-setuptools (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-pip:
python-pip depends on python-colorama; however:
Package python-colorama is not configured yet.
python-pip depends on python-distlib; however:
Package python-distlib is not configured yet.
python-pip depends on python-html5lib; however:
Package python-html5lib is not configured yet.
python-pip depends on python-pkg-resources; however:
Package python-pkg-resources is not configured yet.
python-pip depends on python-requests; however:
Package python-requests is not configured yet.
python-pip depends on python-setuptools (>= 0.6c1); however:
Package python-setuptools is not configured yet.
python-pip depends on python-six; however:
Package python-six is not configured yet.
dpkg: error processing package python-pip (--configure):
dependency problems - leaving unconfigured
Setting up python-wheel (0.24.0-1~ubuntu1.1) ...
Traceback (most recent call last):
File "/usr/bin/pycompile", line 35, in <module>
from debpython.version import SUPPORTED, debsorted, vrepr, \
File "/usr/share/python/debpython/version.py", line 24, in <module>
from ConfigParser import SafeConfigParser
ModuleNotFoundError: No module named 'ConfigParser'
dpkg: error processing package python-wheel (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of unattended-upgrades:
unattended-upgrades depends on lsb-release; however:
Package lsb-release is not configured yet.
dpkg: error processing package unattended-upgrades (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-software-properties:
python3-software-properties depends on lsb-release; however:
Package lsb-release is not configured yet.
python3-software-properties depends on unattended-upgrades; however:
Package unattended-upgrades is not configured yet.
dpkg: error processing package python3-software-properties (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of software-properties-common:
software-properties-common depends on python3-software-properties (= 0.92.37.8); however:
Package python3-software-properties is not configured yet.
dpkg: error processing package software-properties-common (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
lsb-release
python-apt
python-chardet
python-colorama
python-distlib
python-six
python-html5lib
python-pkg-resources
python-urllib3
python-requests
python-setuptools
python-pip
python-wheel
unattended-upgrades
python3-software-properties
software-properties-common
E: Sub-process /usr/bin/dpkg returned an error code (1)
我卡在了这里。我认为当我运行这些命令时,它会调用 python 3.6.8,但我想使用 3.6.1 版本。我该怎么办?