Many python frameworks and modules have dependencies and require installation in their respective folders in order to work. If you’re using any python module then you’ll find it confusing to install it under python’s working directory in windows. This is where easy_install is going to make things easy for you. It installs python modules and it’s respective dependencies easily without you having to do anything.
First, You need to download ez_install script. Second, you need to place this file in a directory where you have setup.py. That place is usually tools/scripts or maybe some another path depending on your platform. Once you copy this file in that folder, simply run it.
Note: In case of python 2.7 setup.py file is in “C:/python2.7/tools/scripts“. Your drive letter may vary between C: or D: or whatever.
After running the ez_install script, you’ll find some files inside folder “/python2.7/scripts“. Now add the following code to the top of your setup.py file.
from ez_setup import use_setuptools
You have to use the path “c:/python2.7/scripts” or whatever that applies in your case to the PATH environment variable.
Follow the steps to add this path to PATH field.
- Right click on My Computer then Click ‘Properties’.
- Click on “Advanced” tab and then “Environment Variables”.
- Check second section namely “System Variables”.
- Find “PATH” field by scrolling the variables.
- Click on “PATH” field to highlight it and then click edit.
- Now copy the path “C:/python2.7/scripts” and paste it into the text area.
Note: Make sure you have semicolon at the start and the end of the pasted path.
Now that we have path to the scripts folder, let’s test it. Go to command prompt and then enter “easy_install” (without quotes of course). In case of windows 7 or vista you’ll have to go through all that admin privileges stuff. If you got that sorted, then script will run the dependencies check and will download required files. Once it is finished you’re free to use easy_install for installing python modules on windows machine.
Hope this tutorial helps you with easy_install on windows. If you have any questions feel free to post here or send me a tweet at @maheshkale.