如何在Mac OS X 10.6.4上卸载Python 2.7? [英] How to uninstall Python 2.7 on a Mac OS X 10.6.4?
问题描述
我想从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
如有必要,请编辑您的外壳配置文件,以删除将/Library/Frameworks/Python.framework/Versions/2.7
添加到您的PATH
环境文件中的情况.根据您使用的外壳,可能会修改以下任何文件:
~/.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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!