(重定向自 Develop.PythonSetupToolMac)

原文参考:http://andreasjacobsen.com/2008/10/10/using-python-setuptools-on-the-mac/

Leopard下面自带Python会造成easy_install报出类似下面这样的错误,说setuptools版本过低:

$ sudo easy_install -U py
Searching for py
Reading http://pypi.python.org/simple/py/
Reading http://pylib.org
Reading http://codespeak.net/py/0.9.2/download.html
Reading http://codespeak.net/py
Reading http://pypi.python.org/simple/py/XXX
Best match: py 0.9.2
Downloading http://pypi.python.org/packages/source/p/py/py-0.9.2.zip#md5=8447b2ba4c7b4062fcd08aab3377f040
Processing py-0.9.2.zip
Running py-0.9.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-PWyaOs/py-0.9.2/egg-dist-tmp-qz0KLA
The required version of setuptools (>=0.6c8) is not available, and
can't be installed while this script is running. Please install
a more recent version first, using '
easy_install -U setuptools'.

(Currently using setuptools 0.6c7 (/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python))
error: Setup script exited with 2

但是真按错误提示里面说的升级setuptools也还是不解决问题,easy_install会执着地接着调用旧版本的setuptools,然后继续执着地报错。解决的办法是以-m参数显式指明模块的方式使用easy_install,比如像下面这样就可以正常使用更新以后的setuptools了:

$ sudo python -m easy_install py

GlossyBlue theme adapted by David Gilbert
Powered by PmWiki