从 Mac OS X El Capitan 卸载 Python 2.7
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35922553/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Uninstall Python 2.7 from Mac OS X El Capitan
提问by Pedro Carvalho
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 StackOverflow tell me to remove a bunch of files, but python is still there.
我想完全重新安装 Python 2,但我找到的任何指南都不允许我卸载它。无论我做什么python --version
,即使在我运行 Python 2.7.11 安装程序之后,仍然返回 2.7.10。StackOverflow 上的所有其他指南都告诉我删除一堆文件,但 python 仍然存在。
回答by Bagoong
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.
我也想做同样的事情。但是我在 Foundation 中遇到了这一段(获取和卸载 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 安装,因此您的路径和用法与您想要执行的操作一致非常重要。
回答by Matheus Marsiglio
Set your an alias to use the python version that you want to use from inside your .bashrc
(or zsh if you use it).
设置别名以使用要从内部使用的 python 版本.bashrc
(或 zsh,如果使用它)。
Like:
alias python='/usr/bin/python3.4'
喜欢:
alias python='/usr/bin/python3.4'
回答by Kevin Pauli
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 中的内置 Python