从Mac OS X El Capitan卸载Python 2.7

时间:2022-11-20 20:28:14

I want to completely reinstall Python 2 but none of the guides I have found allow me to uninstall it. No matter what I do, python --version still returns 2.7.10, even after I run the Python 2.7.11 installer. All the other guides on * tell me to remove a bunch of files, but python is still there.

我想完全重新安装Python 2,但我发现的指南都没有允许我卸载它。无论我做什么,即使在我运行Python 2.7.11安装程序之后,python --version仍然会返回2.7.10。 *上的所有其他指南告诉我删除一堆文件,但python仍然存在。

3 个解决方案

#1


12  

This may be a bit late, but for future searchers I'll post anyway:

这可能有点晚了,但对于未来的搜索者,无论如何我都会发布:

I was looking to do the same. But I came across this paragraph at the Foundation (Getting and uninstalling MacPython) which convinced me to leave well alone and not uninstall it.

我当时也想做同样的事情。但是我在基金会(获取和卸载MacPython)中遇到了这个段落,它说服我单独离开而不是卸载它。

The Apple-provided build of Python is installed in /System/Library/Frameworks/Python.framework and /usr/bin/python, respectively. You should never modify or delete these, as they are Apple-controlled and are used by Apple- or third-party software. Remember that if you choose to install a newer Python version from python.org, you will have two different but functional Python installations on your computer, so it will be important that your paths and usages are consistent with what you want to do.

Apple提供的Python版本分别安装在/System/Library/Frameworks/Python.framework和/ usr / bin / python中。您永远不应修改或删除这些内容,因为它们由Apple控制并由Apple或第三方软件使用。请记住,如果您选择从python.org安装较新的Python版本,您的计算机上将安装两个不同但功能强大的Python,因此您的路径和用法与您想要执行的操作一致非常重要。

#2


1  

Set your an alias to use the python version that you want to use from inside your .bashrc (or zsh if you use it).

设置别名以使用.bashrc中要使用的python版本(如果使用它,则使用zsh)。

Like: alias python='/usr/bin/python3.4'

喜欢:alias python ='/ usr / bin / python3.4'

#3


0  

Agree with the accepted answer that uninstalling is a bad idea, but for those of you using HomeBrew to install your own Python, you don't need an alias as in @Mat Marsiglio's answer. Rather you can do what the HomeBrew installation suggestions:

同意已经接受的答案,卸载是一个坏主意,但对于那些使用HomeBrew安装自己的Python的人,你不需要像@Mat Marsiglio的答案那样的别名。相反,你可以做HomeBrew安装建议:

export PATH="/usr/local/opt/python/libexec/bin:$PATH"

This gives brew's python precedence over the built-in one at /usr/bin/python

这使得brew的python优先于/ usr / bin / python中的内置函数

#1


12  

This may be a bit late, but for future searchers I'll post anyway:

这可能有点晚了,但对于未来的搜索者,无论如何我都会发布:

I was looking to do the same. But I came across this paragraph at the Foundation (Getting and uninstalling MacPython) which convinced me to leave well alone and not uninstall it.

我当时也想做同样的事情。但是我在基金会(获取和卸载MacPython)中遇到了这个段落,它说服我单独离开而不是卸载它。

The Apple-provided build of Python is installed in /System/Library/Frameworks/Python.framework and /usr/bin/python, respectively. You should never modify or delete these, as they are Apple-controlled and are used by Apple- or third-party software. Remember that if you choose to install a newer Python version from python.org, you will have two different but functional Python installations on your computer, so it will be important that your paths and usages are consistent with what you want to do.

Apple提供的Python版本分别安装在/System/Library/Frameworks/Python.framework和/ usr / bin / python中。您永远不应修改或删除这些内容,因为它们由Apple控制并由Apple或第三方软件使用。请记住,如果您选择从python.org安装较新的Python版本,您的计算机上将安装两个不同但功能强大的Python,因此您的路径和用法与您想要执行的操作一致非常重要。

#2


1  

Set your an alias to use the python version that you want to use from inside your .bashrc (or zsh if you use it).

设置别名以使用.bashrc中要使用的python版本(如果使用它,则使用zsh)。

Like: alias python='/usr/bin/python3.4'

喜欢:alias python ='/ usr / bin / python3.4'

#3


0  

Agree with the accepted answer that uninstalling is a bad idea, but for those of you using HomeBrew to install your own Python, you don't need an alias as in @Mat Marsiglio's answer. Rather you can do what the HomeBrew installation suggestions:

同意已经接受的答案,卸载是一个坏主意,但对于那些使用HomeBrew安装自己的Python的人,你不需要像@Mat Marsiglio的答案那样的别名。相反,你可以做HomeBrew安装建议:

export PATH="/usr/local/opt/python/libexec/bin:$PATH"

This gives brew's python precedence over the built-in one at /usr/bin/python

这使得brew的python优先于/ usr / bin / python中的内置函数