Installing Python modules with easy_install


I have been spending some of my spare time reading Learning Python and experimenting with various Python modules. One of the cool things about the Python modules facility is easy_install, which allows you to install modules from local files or a remote location. To install a module from a local directory, you can pass the name of the module to easy_install:

$ easy_install simplejson-2.0.9

Processing
Running setup.py -q bdist_egg –dist-dir /Users/matty/simplejson-2.0.9/egg-dist-tmp-vNeFam
unable to execute gcc: No such file or directory
***************************************************************************
WARNING: The C extension could not be compiled, speedups are not enabled.
Failure information, if any, is above.
I’m retrying the build without the C extension now.
***************************************************************************
***************************************************************************
WARNING: The C extension could not be compiled, speedups are not enabled.
Plain-Python installation succeeded.
***************************************************************************
Adding simplejson 2.0.9 to easy-install.pth file

Installed /Library/Python/2.5/site-packages/simplejson-2.0.9-py2.5.egg
Processing dependencies for simplejson==2.0.9
Finished processing dependencies for simplejson==2.0.9

To install from a network location, you can pass a URL with the location of the module to easy_install:

$ easy_install

Downloading http://pyyaml.org/download/pyyaml/PyYAML-3.08.tar.gz
Processing PyYAML-3.08.tar.gz
Running PyYAML-3.08/setup.py -q bdist_egg –dist-dir /var/folders/-a/-aYP7CaPEk00kLo-WDtJ9U+++TI/-Tmp-/easy_install-3IzAQN/PyYAML-3.08/egg-dist-tmp-5VIWBq
unable to execute gcc: No such file or directory

libyaml is not found or a compiler error: forcing –without-libyaml
(if libyaml is installed correctly, you may need to
specify the option –include-dirs or uncomment and
modify the parameter include_dirs in setup.cfg)
zip_safe flag not set; analyzing archive contents…
Adding PyYAML 3.08 to easy-install.pth file

Installed /Library/Python/2.5/site-packages/PyYAML-3.08-py2.5-macosx-10.5-i386.egg
Processing dependencies for PyYAML==3.08
Finished processing dependencies for PyYAML==3.08

You can also pass the name of a module to easy_install:

$ easy_install pexpect

Searching for pexpect
Reading http://pypi.python.org/simple/pexpect/
Reading http://pexpect.sourceforge.net/
Reading http://sourceforge.net/project/showfiles.php?group_id=59762
Best match: pexpect 2.4
Downloading http://pypi.python.org/packages/source/p/pexpect/pexpect-2.4.tar.gz#md5=fe82d69be19ec96d3a6650af947d5665
Processing pexpect-2.4.tar.gz
Running pexpect-2.4/setup.py -q bdist_egg –dist-dir /tmp/easy_install-3b5oOV/pexpect-2.4/egg-dist-tmp-aYlhyn
zip_safe flag not set; analyzing archive contents…
Adding pexpect 2.4 to easy-install.pth file

Installed /Library/Python/2.5/site-packages/pexpect-2.4-py2.5.egg
Processing dependencies for pexpect
Finished processing dependencies for pexpect

Which will cause easy_install to search the Python package index, and install the module based on information in the package index. I loves me some Python!

This article was posted by Matty on 2009-06-21 10:35:00 -0400 -0400