在Mac OSX上卸载Python并重新安装

3
我想知道有没有人知道如何完全从Mac OSX(10.5.8)中删除Python安装,包括虚拟环境及其相关的二进制文件。在过去的几年中,我已经完全搞砸了安装的网站包、虚拟环境等等,唯一的解决方法就是卸载所有东西,然后重新安装。
我想重新做一切,并从头开始使用virtualenv、pip等工具。
另一方面,如果有人知道不必删除Python并重新安装即可完成此操作的方法,我很乐意听取建议。
谢谢,
Will
2个回答

1

仅供大家参考。我在Python文档这里找到了这个:

Mac OS X 10.5 comes with Python 2.5.1 pre-installed by Apple. If you wish, you are invited to install the most recent version of Python from the Python website (http://www.python.org). A current “universal binary” build of Python, which runs natively on the Mac’s new Intel and legacy PPC CPU’s, is available there.

What you get after installing is a number of things:

* A MacPython 2.5 folder in your Applications folder. In here you find

IDLE, the development environment that is a standard part of official Python distributions; PythonLauncher, which handles double-clicking Python scripts from the Finder; and the “Build Applet” tool, which allows you to package Python scripts as standalone applications on your system. * A framework /Library/Frameworks/Python.framework, which includes the Python executable and libraries. The installer adds this location to your shell path. To uninstall MacPython, you can simply remove these three things. A symlink to the Python executable is placed in /usr/local/bin/.

我删除了这些文件和virtualenv目录,然后重新安装了一切,现在工作正常。


0

你应该能够从 /Library/Python/2.*/site-packages/ 中删除你安装的包。我不认为任何包安装程序会默认安装到 /System/Library,这样就可以避免需要删除 Python 本身。

话虽如此,你也可以使用带有 --no-site-packages 的 virtualenv,并且只需忽略你已经系统范围内安装的任何包,而无需将它们删除。


1
问题在于,当我执行 pip installeasy_install 等操作时,它们并没有安装到实际的 Python 安装目录中。例如 pip install numpy 可以成功执行,但随后的 import numpy 却失败了。无论是在 virtualenv、基础分发版等环境下进行这些操作,都会出现这种情况。我想我可能把符号链接搞错了。 - JudoWill

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接