TroyGrosfield.com TroyGrosfield.com

Headline

Installing easy_install and pip for Python

Author
by Troy Grosfield
Date
December 18th, 2010
Category
Developer
Story

easy_install and pip are python package installers that will make your life a lot easier when developing in python.

Installation

These steps assume you already have python installed and that python is in your windows environment variables.

  1. Download setup-tools according to your python version.  I’m currently running python 2.7 and running on windows so I downloaded the following .exe: setuptools-0.6c11.win32-py2.7.exe
  2. Run the .exe file. The installer will automatically find your python installation location from the registry and install easy_install to the Scripts directory where your python installation is located.
  3. Once the installer has run, add easy_install to the windows environment variables path.
  4. Open a command window
  5. Run the following command:
    easy_install pip

    and watch the magic happen. It will download and install pip for you!

Usage

Once you have pip installed you can easily download python packages. Example, the following command will install the elementtree (xml parsing) package for you:

pip install elementtree

This installation will give you elementtree 1.2.7. Since I wanted elementtree 1.3 I went to the elementtree website and grabbed the svn location and ran:

pip installed http://svn.effbot.org/public/elementtree-1.3/

That’s it for installation!  Now if you go to a new command window you can verify your installation worked:

C:\>python
Python 2.7 (r27:82525, Jul  4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import elementtree
>>>

If you don’t see any error messages the installation was successful and you can now use the elementtree package in python!

Tags
Comments
No Comments »

No Comments Yet

Leave a reply