简体   繁体   English

如何在OSX上恢复默认的python安装?

[英]How can I restore my default python install on OSX?

I'm trying to install pyobjc (using pyobjc-1.2-python2.3-macosx10.2.dmg) on a Mac running OSX 10.6 and I get the following error message: 我试图在运行OSX 10.6的Mac上安装pyobjc(使用pyobjc-1.2-python2.3-macosx10.2.dmg),并且收到以下错误消息:

替代文字

To use Python 2.3 I tried re-editing my .bash_profile and I commented out everything with the exception of this line: 要使用Python 2.3,我尝试重新编辑.bash_profile,并注释掉了以下行以外的所有内容:

# change python version 
defaults write com.apple.versioner.python Version 2.3

I did previously include this: 我之前确实包括过:

PATH="/Library/Frameworks/Python.framework/Versions/2.3/bin:/usr/bin:/bin${PATH}"
export PATH

but at the moment left it out. 但此刻遗漏了。 I know that when I type python in the terminal it gives me Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29) so it clearly is not using 2.3. 我知道,当我在终端中键入python时,它会给我Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29)因此显然它没有使用2.3。

What can I do to fix this? 我该怎么做才能解决此问题?

That version of PyObjC is very old. PyObjC版本非常旧。 It may not even run on Mac OS X 10.6. 它甚至可能无法在Mac OS X 10.6上运行。 Further, Apple doesn't ship a full python2.3 with OS X 10.6. 此外,Apple并未在OS X 10.6上发布完整的python2.3。 The Apple-supplied Python 2.6 ( /usr/bin/python2.6 ) already has PyObjC installed. 苹果提供的Python 2.6( /usr/bin/python2.6 )已经安装了PyObjC If you need an even newer version, installer the latest Python 2.6 (or Python 2.7 ) using a OS X installer from the python.org website, install easy_install for that Python using Distribute or setuptools , and then install PyObjC from PyPi : 如果您需要更高版本,请使用python.org网站上的OS X安装程序安装最新的Python 2.6 (或Python 2.7 ),使用Distributesetuptools为该Python安装easy_install ,然后从PyPi安装PyObjC

/Library/Frameworks/Python.framework/Versions/2.6/bin/easy_install pyobjc

You should undo the effects of that defaults command, too. 您也应该撤消该defaults命令的效果。 It is only going to cause problems. 这只会引起问题。

defaults write com.apple.versioner.python Version 2.6

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM