[英]Removing python and then re-installing on Mac OSX
I was wondering if anyone had tips on how to completely remove a python installation form Mac OSX (10.5.8) ... including virtual environments and its related binaries. 我想知道是否有人提示如何从Mac OSX(10.5.8)中完全删除python安装...包括虚拟环境及其相关的二进制文件。 Over the past few years I've completely messed up the installed site-packages, virtual-environments, etc. and the only way I can see to fix it is to just uninstall everything and re-install. 在过去的几年里,我已经完全搞砸了已安装的网站包,虚拟环境等,我能看到修复它的唯一方法就是卸载所有内容并重新安装。
I'd like to completely re-do everything and use virtualenv, pip, etc. from the beginning. 我想完全重新做一切,并从一开始就使用virtualenv,pip等。
On the other hand if anyone knows a way to do this without removing python and re-installing I'd be happy to here about it. 另一方面,如果有人知道如何在不删除python并重新安装的情况下执行此操作,我会很高兴在这里谈论它。
Thanks, 谢谢,
Will 将
Just for everyone else's reference. 仅供其他人参考。 I found this in the Python documentation here : 我发现这个Python文档在这里 :
Mac OS X 10.5 comes with Python 2.5.1 pre-installed by Apple. Mac OS X 10.5附带Apple预安装的Python 2.5.1。 If you wish, you are invited to install the most recent version of Python from the Python website ( http://www.python.org ). 如果您愿意,可以从Python网站( http://www.python.org )安装最新版本的Python。 A current “universal binary” build of Python, which runs natively on the Mac's new Intel and legacy PPC CPU's, is available there. Python的当前“通用二进制”版本可以在Mac的新英特尔和传统PPC CPU上本地运行。
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; IDLE,开发环境是官方Python发行版的标准部分; PythonLauncher, which handles double-clicking Python scripts from the Finder; PythonLauncher,它处理从Finder双击Python脚本; and the “Build Applet” tool, which allows you to package Python scripts as standalone applications on your system. 以及“Build Applet”工具,它允许您将Python脚本打包为系统上的独立应用程序。 * A framework /Library/Frameworks/Python.framework, which includes the Python executable and libraries. *框架/Library/Frameworks/Python.framework,包括Python可执行文件和库。 The installer adds this location to your shell path. 安装程序将此位置添加到shell路径。 To uninstall MacPython, you can simply remove these three things. 要卸载MacPython,您可以简单地删除这三件事。 A symlink to the Python executable is placed in /usr/local/bin/. Python可执行文件的符号链接放在/ usr / local / bin /中。
I removed these and the virtualenv
directories. 我删除了这些和virtualenv
目录。 Then I re-installed everything and its working fine now. 然后我重新安装了一切,现在工作正常。
You should be able to delete the packages you've installed from /Library/Python/2.*/site-packages/. 您应该能够从/Library/Python/2.*/site-packages/删除已安装的软件包。 I do not think any package installers will install by default to /System/Library, which should save you from needing to remove Python itself. 我认为任何软件包安装程序都不会默认安装到/ System / Library,这样可以避免需要删除Python本身。
That said, you could also use virtualenv with --no-site-packages, and just ignore whatever packages you've installed system-wide without needing to remove them. 也就是说,您也可以将virtualenv与--no-site-packages一起使用,并忽略您在系统范围内安装的任何软件包,而无需删除它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.