HOWTO: Install Setuptools in Windows

If you are in the habit of loading third-party modules in Python, you really should check out Setuptools. Setuptools includes all sorts of enhancements to the Python distutils to help developers build and distribute their applications. But most importantly (for me at least), it includes the EasyInstall utility:

Easy Install is a python module (easy_install) bundled with setuptools that lets you automatically download, build, install, and manage Python packages.

Here’s how to install it and make sure it’s working properly…


0. Install Python

Make sure you have Python installed.

1. Download the bootstrap script

Download the bootstrap module (ez_install.py) and save it somewhere on your Windows box. According to the documentation, they recommend not putting it in your Python distribution.

2. Install Setuptools using the script

Open up a console (Start | Run | cmd) and run the script:

C:\Documents and Settings\John\Desktop\ez_setup.py
It will automatically install everything you need.

3. Update your environment variables

Right click the My Computer icon on your desktop and hit Properties. Click the Advanced tab and hit the Environment Variables button near the bottom:


That will bring up the System Variables screen:


Now highlight the Path variable and hit Edit:


Add C:\Python25\Scripts to your Path.

4. Testing and basic usage

Congrats. At this point you should be all set.

If you’d like to test it and/or install a package, just open up a console and use the easy_install command. For example, if you would like to install Paste:

C:\Documents and Settings\John>easy_install Paste

Searching for Paste
Reading http://cheeseshop.python.org/pypi/Paste/
Reading http://pythonpaste.org
Reading http://cheeseshop.python.org/pypi/Paste/1.2.1
Best match: Paste 1.2.1
Downloading http://cheeseshop.python.org/packages/...
Processing Paste-1.2.1.tar.gz
Running Paste-1.2.1\setup.py -q bdist_egg --dist-dir...
Adding paste 1.2.1 to easy-install.pth file

Installed c:\python25\lib\site-packages\paste-1.2.1-py2.5.egg
Processing dependencies for Paste
And just to make sure it worked:

C:\Documents and Settings\John>python
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17)...
...
>>> import paste
That’s it! If you are looking for more modules/packages, check out the Python Cheese Shop. Enjoy!

PS. As a side note, I realized that although you can install PIL via easy_install, it doesn’t seem to import properly. A quick scan of Google makes me think I’m not the only one that had that problem. Not sure what’s up with that.
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章