我是ubuntu的新手,感谢您阅读此主题。
我试图删除并重新安装 pip 和 python2.7,python3.6,python3.8 等...
但是我以某种方式损坏了它,却不知道如何解决。
这是我用来删除python的一些命令:
sudo apt-get remove pythonX
sudo apt-get autoremove pythonX
sudo apt-get purge pythonX
sudo apt-get autoremove --purge pythonX
X是2.7 3.6 3.8等...
现在我收到此错误消息,提示未安装python2.7
freddie@Freddie:/usr/bin$ sudo apt-get autoremove --purge python2.7
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'python2.7' is not installed,so not removed
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
cloud-init : Depends: netplan.io but it is not going to be installed or
ifupdown
dh-python : Depends: python3-distutils but it is not going to be installed
landscape-common : Depends: python3-gdbm but it is not going to be installed
python3-commandnotfound : Depends: python3-gdbm but it is not going to be installed
python3-cryptography : Depends: python3-cffi-backend-api-min (<= 9729)
Depends: python3-cffi-backend-api-max (>= 9729)
python3-pip : Depends: python3-distutils but it is not going to be installed
Recommends: python3-dev (>= 3.2) but it is not going to be installed
python3-setuptools : Depends: python3-distutils but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
E: Could not read response to hello message from hook [ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt 2>/dev/null || true: Success
但是我仍然可以执行python2.7 --version
这样的python命令freddie@Freddie:/usr/bin$ python2.7 --version
Python 2.7.17
作为建议,我尝试了sudo apt --fix-broken install
,它给了我更多错误,如下所示:
freddie@Freddie:/usr/bin$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
apport-symptoms libexpat1-dev libpython3-dev libpython3.6-dev python3.6-dev
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
libnetplan0 netplan.io python3-cffi-backend python3-distutils python3-gdbm
Suggested packages:
network-manager | wpasupplicant python3-gdbm-dbg
E: Could not read response to hello message from hook [ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt 2>/dev/null || true: Success
E: Could not read response to hello message from hook [ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt 2>/dev/null || true: Success
有人知道如何解决此问题吗?
感谢您的阅读。