Saturday, June 13, 2009

Python easy_install, really

Python's easy_install, at least under Ubuntu, is neither easy, nor does it install stuff if you're not root.

Here's the shortcut:
- make your local packages directory. This means you can easily zap all your "I'm playing around with it" libraries and apps without damaging the system.
- tell Python (and easy_install) to search it
- also, tell easy_install to install packages into it

$ mkdir -p $HOME/local/lib/python2.6/site-packages
$ export PYTHONPATH=$HOME/local/lib/python2.6/site-packages
$ easy_install-2.6 -d $HOME/local/lib/python2.6/site-packages pyevolve

If the automatic network search doesn't work, then manually download the Egg and try again:

$ easy_install-2.6 -d $HOME/local/lib/python2.6/site-packages Desktop/Pyevolve-0.5-py2.6.egg

Then test it:
$ python -c 'import pyevolve; print pyevolve.__version__'

Note you'll have to add the PYTHONPATH into your ~/.bashrc, else you'll get errors like this:
$  (env -i !!)
(env -i python -c 'import pyevolve')
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named pyevolve

No comments:

Post a Comment