根据本指南,我在Ubuntu16.04上安装了Python2.7.13,它成为了版本2.7.12的默认版本。但是,我希望完全删除Python2.7.13,并将其作为默认版本返回到2.7.12版本,因为pip
命令无法处理以下错误。
bash: /usr/local/bin/pip: /usr/bin/python: bad interpreter: No such file or directory
您能帮我从Ubuntu16.04中完全删除Python2.7.13吗?否则,请您建议如何纠正上述错误?
发布于 2017-07-29 18:24:28
警告:不建议将默认Python从Ubuntu中删除,这可能会导致GDM(图形显示管理器,提供图形登录功能)失败。
要完全卸载Python2.x.x,一切都取决于它。使用以下命令:
sudo apt purge python2.x-minimal
因为仍然有很多包依赖于Python2.x.x。因此,在让它继续之前,您应该仔细查看apt想要删除的包。
谢谢,我希望这对你有帮助。
发布于 2020-03-08 17:18:12
我是怎么做的:
# Remove python2
sudo apt purge -y python2.7-minimal
# You already have Python3 but
# don't care about the version
sudo ln -s /usr/bin/python3 /usr/bin/python
# Same for pip
sudo apt install -y python3-pip
sudo ln -s /usr/bin/pip3 /usr/bin/pip
# Confirm the new version of Python: 3
python --version
发布于 2017-09-25 03:36:08
试着跟随查看python的所有实例
whereis python
which python
然后使用以下方法删除所有实例:
sudo apt autoremove python
重复应该这样做的sudo apt自动删除python(针对所有版本),然后安装Anaconda,如果需要重新安装它,可以任意管理Pythons。
https://stackoverflow.com/questions/44602191
复制相似问题