11 Aug 2009

如何在windows xp下安装python2.6的setuptools

最近开始学python,要安装很多egg文件,但发现http://pypi.python.org/pypi/setuptools#downloads没有python2.6的MS Windows installer版本,google了一把,用如下方法解决:

1. 下载 setuptools-0.6c9.tar.gz
2. 下载 setuptools-0.6c9-py2.6.egg (放在同一个目录)
3. 用7-zip或者其他解压工具打开 setuptools-0.6c9.tar.gz ,并且把里面的 ez_setup.py 文件解压到同一个目录里。
4. 打开cmd窗口,并进入你刚才下载和解压文件的目录里。(例如: d:\downloads\)
5. 输入 python ez_setup.py setuptools-0.6c9-py2.6.egg

提示如下:

E:\temp>python ez_setup.py setuptools-0.6c9-py2.6.egg
Processing setuptools-0.6c9-py2.6.egg
Copying setuptools-0.6c9-py2.6.egg to c:\python26\lib\site-packages
Adding setuptools 0.6c9 to easy-install.pth file
Installing easy_install-script.py script to C:\Python26\Scripts
Installing easy_install.exe script to C:\Python26\Scripts
Installing easy_install-2.6-script.py script to C:\Python26\Scripts
Installing easy_install-2.6.exe script to C:\Python26\Scripts

Installed c:\python26\lib\site-packages\setuptools-0.6c9-py2.6.egg Processing dependencies for setuptools==0.6c9 Finished processing dependencies for setuptools==0.6c9 Processing setuptools-0.6c9-py2.6.egg Removing c:\python26\lib\site-packages\setuptools-0.6c9-py2.6.egg Copying setuptools-0.6c9-py2.6.egg to c:\python26\lib\site-packages setuptools 0.6c9 is already the active version in easy-install.pth Installing easy_install-script.py script to C:\Python26\Scripts Installing easy_install.exe script to C:\Python26\Scripts Installing easy_install-2.6-script.py script to C:\Python26\Scripts Installing easy_install-2.6.exe script to C:\Python26\Scripts

Installed c:\python26\lib\site-packages\setuptools-0.6c9-py2.6.egg Processing dependencies for setuptools==0.6c9 Finished processing dependencies for setuptools==0.6c9

E:\temp>