[英]OS X 10.8: Repairing badly broken Python install, path vars, modules
So sorry for posting yet another of these types of questions, I've looked extensively and can't find an answer. 很抱歉发布了这些类型的问题,我看了很多,但找不到答案。
I'm a Python nub, and have only a loose grasp of Unix. 我是一个Python小组,只是对Unix的松散掌握。
I specifically need to develop in Python2.5. 我特别需要在Python2.5中开发。 I also need access to AppKit. 我还需要访问AppKit。 I'd installed Python2.5 via the universal installer along with the libraries I needed. 我通过通用安装程序和我需要的库安装了Python2.5。 At the time, the default OS install, 2.7, was able to import AppKit. 当时,默认的OS安装2.7能够导入AppKit。 Python2.5, meanwhile, could not. 同时,Python2.5不能。 I found this tutorial for replacing the native install of Python, and thought that if I followed it to the letter but for switching out the 2.7 install for 2.5, everything would be swell. 我发现这个教程用于替换Python的本机安装,并认为如果我按照它来执行,但是为了切换2.5安装2.5,一切都会膨胀。
After following the tutorial, my native Python is indeed 2.5. 在学习完本教程后,我的原生Python确实是2.5。 However, AppKit, which continues to be installed where it previously had been working for the native Python, still cannot be imported (ie. "no module named AppKit"). 但是,仍然无法导入AppKit,它继续安装在以前用于本机Python的地方(即“没有名为AppKit的模块”)。
which python
returns /usr/bin/python
来自bash, which python
返回/usr/bin/python
/System/Library/Frameworks/Python.framework
with symbolic links to /Library/Frameworks/Python.framework
. 我的主要安装位于: /System/Library/Frameworks/Python.framework
带有指向/Library/Frameworks/Python.framework
符号链接。 The binaries are likewise linked; 二进制同样联系在一起; usr/bin/python
(and pythonw, python-config, pydoc) are all symlinked to /usr/local/bin
. usr/bin/python
(和pythonw,python-config,pydoc)都符号链接到/usr/local/bin
。 /usr/bin
and /usr/local/bin
because I've never used easy_install and didn't know either way what to do with it. 我在/usr/bin
和/usr/local/bin
都留下了easy_install(和easy_install-2.5 / 6/7),因为我从未使用过easy_install,也不知道如何处理它。 I'm perfectly aware of how profoundly I've messed everything up. 我完全清楚我已经把事情搞得一团糟。 Can anyone please tell me what I need to be doing to get things back in order? 任何人都可以告诉我我需要做些什么才能恢复原状?
UPDATE: Following the comments below, I did indeed end up re-installing Mountain Lion. 更新:根据以下评论,我确实最终重新安装了Mountain Lion。 Couldn't have been less painless; 不可能不那么无痛; I had indeed correctly installed AppKit, and as soon as the native Python was reinstalled I was able to work immediately. 我确实正确安装了AppKit,并且一旦重新安装本机Python,我就能立即工作。
It seems you've had a difficult day. 看来你有一个艰难的一天。 Let me give you some guidance: 我来给你一些指导:
Replacing the default Python is a really really really bad idea ( Remove preinstalled python from Mac OSX 10.8 , For real, too many installations of Python on OSX Mountain Lion ) 替换默认的Python是一个非常非常糟糕的主意( 从Mac OSX 10.8中删除预安装的python , 对于OSX Mountain Lion上的太多Python安装 )
You should try to rollback your machine by whatever means you can ( carlosdc suggested timemachine - that would be a great option if you have a snapshot ). 您应该尝试以任何方式回滚您的机器(carlosdc建议使用timemachine - 如果您有快照,这将是一个很好的选择)。
You can use virtualenv
to create custom environments 您可以使用virtualenv
来创建自定义环境
You can also use shell scripts and your user's .profile/.bash to specify which Python version should be prioritized. 您还可以使用shell脚本和用户的.profile / .bash来指定应优先考虑哪个Python版本。
I had that problem too and fixed it just installing python again, downloading it from the official website 我也有这个问题并修复它只是再次安装python,从官方网站下载
ps: my OS is el capitan ps:我的操作系统是el capitan
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.