100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > 如何在Mac OS X 10.6.4上卸载Python 2.7?

如何在Mac OS X 10.6.4上卸载Python 2.7?

时间:2021-02-06 05:21:51

相关推荐

如何在Mac OS X 10.6.4上卸载Python 2.7?

本文翻译自:How to uninstall Python 2.7 on a Mac OS X 10.6.4?

I want to completely remove Python 2.7 from my Mac OS X 10.6.4.我想从Mac OS X 10.6.4中完全删除Python 2.7。I managed to remove the entry from thePATHvariable by reverting my.bash_profile.我设法通过还原.bash_profilePATH变量中删除了该条目。But I also want to remove all directories, files, symlinks, and entries that got installed by the Python 2.7 install package.但是我也想删除所有由python 2.7安装包安装的目录,文件,符号链接和条目。I've got the install package from / .我从/获得了安装包。What directories/files/configuration file entries do I need to remove?我需要删除哪些目录/文件/配置文件条目?Is there a list somewhere?某处有清单吗?

#1楼

参考:/question/G1c1/如何在Mac-OS-X-上卸载Python

#2楼

This one works:这个作品:

cd /usr/local/bin/ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework/Versions/2.7' | awk '{print $9}' | tr -d @ | xargs rm

Description: It list all the links, removes@character and then removes them.说明:列出所有链接,删除@字符,然后删除它们。

#3楼

If you installed it using the PKG installer, you can do:如果使用PKG安装程序安装了它,则可以执行以下操作:

pkgutil --pkgs

or better:或更好:

pkgutil --pkgs | grep org.python.Python

which will output something like:这将输出类似:

org.python.Python.PythonApplications-2.7org.python.Python.PythonDocumentation-2.7org.python.Python.PythonFramework-2.7org.python.Python.PythonProfileChanges-2.7org.python.Python.PythonUnixTools-2.7

you can now select which packages you will unlink (remove).您现在可以选择要取消链接(删除)的软件包。

This is the unlink documentation:这是取消链接文档:

--unlink package-idUnlinks (removes) each file referenced by package-id. WARNING: This command makes no attempt to perform reference counting or dependency analy-sis. It can easily remove files required by your system. It may include unexpected files due to package tainting. Use the --files command firstto double check.

In my example you will type在我的示例中,您将输入

pkgutil --unlink org.python.Python.PythonApplications-2.7pkgutil --unlink org.python.Python.PythonDocumentation-2.7pkgutil --unlink org.python.Python.PythonFramework-2.7pkgutil --unlink org.python.Python.PythonProfileChanges-2.7pkgutil --unlink org.python.Python.PythonUnixTools-2.7

or in one single line:或一行:

pkgutil --pkgs | grep org.python.Python | xargs -L1 pkgutil -f --unlink

Important: --unlink is not available anymore starting with Lion (as of Q1` that would include Lion, Mountain Lion, and Mavericks).重要提示:--unlink从Lion(从第一季度开始,包括Lion,Mountain Lion和Mavericks)不再可用。If anyone that comes to this instructions try to use it with lion, should try instead to adapt it with what this post is saying: /wiki/Uninstalling_packages_(.pkg_files)_on_Mac_OS_X如果涉及此说明的任何人都尝试将其与狮子一起使用,则应尝试改编本文所讲的内容: https : ///wiki/Uninstalling_packages_(.pkg_files)_on_Mac_OS_X

#4楼

No need to uninstall old python versions.无需卸载旧的python版本。

Just install new version say python-3.3.2-macosx10.6.dmg and change the soft link of python to newly installed python3.3只需安装新版本,说python-3.3.2-macosx10.6.dmg并将python的软链接更改为新安装的python3.3

Check the path of default python and python3.3 with following commands使用以下命令检查默认python和python3.3的路径

"which python" and "which python3.3"“哪个python”和“哪个python3.3”

then delete existing soft link of python and point it to python3.3然后删除python的现有软链接并将其指向python3.3

#5楼

关于删除符号链接,我发现这很有用。

find /usr/local/bin -lname '../../../Library/Frameworks/Python.framework/Versions/2.7/*' -delete

#6楼

Note:If you installed Python using Homebrew, then you can follow the following steps, otherwise look for another solution!注意:如果使用Homebrew安装了Python,则可以按照以下步骤操作,否则请寻找其他解决方案!

To uninstall Python 2.7.10 which you installed using Homebrew, then you can simply issue the following command:要卸载使用Homebrew安装的Python 2.7.10,可以简单地发出以下命令:

brew uninstall python

Similarly, if you want to uninstall Python 3 (which you installed using Homebrew):同样,如果要卸载Python 3(使用Homebrew安装),请执行以下操作:

brew uninstall --force python3

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。