Donnerstag, 19. Februar 2009

Have your python toolchain in $HOME

In my previous post I explained how to install scipy from source on openSUSE.

What makes it particularly nice is that I can now carry most of my toolchain in my $HOME. I make python include modules from within my $HOME by setting $PYTHONPATH to something like
/home/micha/mypython/lib64/site-packages
. The good thing is that you can install any python package in your $HOME by using the --prefix option to setup.py:
python setup.py install --prefix=$HOME/mypython


For even more python goodness I tell easy_install to put everything there by having a file called .pydistutils.cfg in my $HOME with the contents

[install]
prefix=/home/micha/mypython


So everytime I easy_install a package, it is automatically put into my $HOME directory. That makes it much easier to reinstall or upgrade the system. Since most python-related stuff is now in my $HOME and not in the system, rebuilding my python-toolchain basically consists of installing python and distutils. Isn't that great :)

Update: I learnt from Brandon Rhodes that virtualenv will set up everything for you automatically. Awesome python goodness.

Keine Kommentare: