我打破了蟒蛇!无法使用apt安装任何软件包,因为“尚未配置软件包python3。”

I tried to change my default python3 from 3.6 to 3.7 and I realized it's a bad decision since everything was messed up.

I then tried to bring it back to 3.6.9. I also removed python3 and reinstalled it via the source.

now I can't install anything with apt-get install and I also can't do apt upgrade because it gives the following error: (there's a very verbose error but here's the summary:)

Errors were encountered while processing:

 python3
 python3-cffi-backend
 python3-keyring
 python3-crypto
 python3-requests-unixsocket
 python3-idna
 python3-xdg
 python3-update-manager
 python3-keyrings.alt
 python3-six
 python3-certifi
 python3-aptdaemon.gtk3widgets
 python3-wheel
 python3-pkg-resources
 python3-gi
 lsb-release
 python3-apport
 python3-defer
 python3-problem-report
 python3-asn1crypto
 ubuntu-drivers-common
 python3-configargparse
 python3-debconf
 software-properties-gtk
 python3-chardet
 python3-aptdaemon
 python3-systemd
 python3-all
 aptdaemon
 python3-httplib2
 python3-pip
 python3-requests
 python3-software-properties
 python3-urllib3
 python3-setuptools
 python3-lib2to3
 python3-secretstorage
 dh-python
 python3-debian
 python3-distutils
 python3-distupgrade
 python3-dateutil
 python3-xkit
 software-properties-common
 python3-cryptography
 python3-distro-info
 python3-apt
 python3-dbus

额外信息

ls -la /usr/bin | grep python:

lrwxrwxrwx  1 root   root          39 مه     9 05:04 apt_pkg.cpython-36m-x86_64-linux-gnu.so -> apt_pkg.cpython-34m-x86_64-linux-gnu.so
lrwxrwxrwx  1 root   root          26 مارس  27  2018 dh_pypy -> ../share/dh-python/dh_pypy
-rwxr-xr-x  1 root   root        1056 آوریل 16  2018 dh_python2
lrwxrwxrwx  1 root   root          23 آوریل 15 21:50 pdb2.7 -> ../lib/python2.7/pdb.py
lrwxrwxrwx  1 root   root          23 آوریل 18 06:26 pdb3.6 -> ../lib/python3.6/pdb.py
lrwxrwxrwx  1 root   root          23 نوامب  7  2019 pdb3.7 -> ../lib/python3.7/pdb.py
lrwxrwxrwx  1 root   root          31 اكتبر 17  2019 py3versions -> ../share/python3/py3versions.py
lrwxrwxrwx  1 root   root          26 مارس  27  2018 pybuild -> ../share/dh-python/pybuild
lrwxrwxrwx  1 root   root          18 مه     9 16:10 python -> /usr/bin/python2.7
lrwxrwxrwx  1 root   root           9 اكتبر 17  2019 python2 -> python2.7
-rwxr-xr-x  1 root   root     3637096 آوریل 15 21:50 python2.7
lrwxrwxrwx  1 root   root          33 آوریل 15 21:50 python2.7-config -> x86_64-linux-gnu-python2.7-config
lrwxrwxrwx  1 root   root          16 آوریل 16  2018 python2-config -> python2.7-config
lrwxrwxrwx  1 root   root          18 مه     9 16:07 python3 -> /usr/bin/python3.6
-rwxr-xr-x  1 root   root    13326488 مه     9 14:30 python3.6
lrwxrwxrwx  1 root   root          16 آوریل 16  2018 python-config -> python2.7-config
lrwxrwxrwx  1 root   root          29 اكتبر 17  2019 pyversions -> ../share/python/pyversions.py
-rwxr-xr-x  1 root   root        2971 آوریل 15 21:50 x86_64-linux-gnu-python2.7-config
lrwxrwxrwx  1 root   root          33 آوریل 16  2018 x86_64-linux-gnu-python-config -> x86_64-linux-gnu-python2.7-config

Python版本:

~:> python -V
Python 2.7.17
~:> python3 -V
Python 3.6.9

备择方案:

python3:

#:> update-alternatives --config python3
There is only one alternative in link group python3 (providing /usr/bin/python3): 
/usr/bin/python3.6
Nothing to configure.
update-alternatives: warning: forcing reinstallation of alternative /usr/bin/python3.6 
because link group python3 is broken

python2:

#:> update-alternatives --config python 
There is only one alternative in link group python (providing /usr/bin/python): 
/usr/bin/python2.7
Nothing to configure.
update-alternatives: warning: forcing reinstallation of alternative /usr/bin/python2.7 
because link group python is broken
评论