问题描述
我想从我的 Mac OS X 10.6.4 中完全删除 Python 2.7.通过恢复我的 .bash_profile
,我设法从 PATH
变量中删除了条目.但我也想删除 Python 2.7 安装包安装的所有目录、文件、符号链接和条目.我从 http://www.python.org/ 获得了安装包.我需要删除哪些目录/文件/配置文件条目?某处有清单吗?
I want to completely remove Python 2.7 from my Mac OS X 10.6.4. I managed to remove the entry from the PATH
variable by reverting my .bash_profile
. But I also want to remove all directories, files, symlinks, and entries that got installed by the Python 2.7 install package. I've got the install package from http://www.python.org/. What directories/files/configuration file entries do I need to remove? Is there a list somewhere?
推荐答案
不要试图删除 /System/Library
和 /usr/bin 中的任何 Apple 提供的系统 Python
,因为这可能会破坏您的整个操作系统.
注意:下面列出的步骤不会影响 Apple 提供的系统 Python 2.7;他们只删除第三方 Python 框架,例如由 python.org 安装程序安装的那些.
Do not attempt to remove any Apple-supplied system Python which are in /System/Library
and /usr/bin
, as this may break your whole operating system.
NOTE: The steps listed below do not affect the Apple-supplied system Python 2.7; they only remove a third-party Python framework, like those installed by python.org installers.
完整列表记录在此处.基本上,您需要做的就是:
The complete list is documented here. Basically, all you need to do is the following:
删除第三方 Python 2.7 框架
Remove the third-party Python 2.7 framework
sudo rm -rf /Library/Frameworks/Python.framework/Versions/2.7
删除 Python 2.7 应用程序目录
Remove the Python 2.7 applications directory
sudo rm -rf "/Applications/Python 2.7"
删除 /usr/local/bin
中指向此 Python 版本的符号链接.使用
Remove the symbolic links, in /usr/local/bin
, that point to this Python version. See them using
ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework/Versions/2.7'
然后运行以下命令删除所有链接:
and then run the following command to remove all the links:
cd /usr/local/bin/
ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework/Versions/2.7' | awk '{print $9}' | tr -d @ | xargs rm
如有必要,编辑您的 shell 配置文件以删除将 /Library/Frameworks/Python.framework/Versions/2.7
添加到您的 PATH
环境文件.根据您使用的 shell,以下任何文件可能已被修改:~/.bash_login
、~/.bash_profile
、~/.cshrc
、~/.profile
、~/.tcshrc
和/或 ~/.zprofile
.
If necessary, edit your shell profile file(s) to remove adding /Library/Frameworks/Python.framework/Versions/2.7
to your PATH
environment file. Depending on which shell you use, any of the following files may have been modified:~/.bash_login
, ~/.bash_profile
, ~/.cshrc
, ~/.profile
, ~/.tcshrc
, and/or ~/.zprofile
.
这篇关于如何在 Mac OS X 10.6.4 上卸载 Python 2.7?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!