Wed, 30 Jan 2008 11:38:00 in Tech stuff | permalink
Many popular Python libraries are available in various Linux distributions. However, it is not always possible and/or desirable to install them from packages. For instance, sometimes you don't have root access to the target machine or just want to have other vesrion of some library isolated under your home directory.
I've been successfully using this approach on my laptop and several development and production sites for about two years so far.
Suppose, Python is already installed in the system. To prepare the home-based environment the following steps need to be taken:
$ mkdir -p $HOME/lib/python $HOME/bin
$ echo '[install]' > $HOME/.pydistutils.cfg $ echo 'home=$HOME' >> $HOME/.pydistutils.cfg
$ echo 'export PATH=$HOME/bin:$PATH' >> $HOME/.bash_profile $ echo 'export PYTHONPATH=$HOME/lib/python' >> $HOME/.bash_profile $ export PATH=$HOME/bin:$PATH $ export PYTHONPATH=$HOME/lib/python
$ wget http://peak.telecommunity.com/dist/ez_setup.py $ python ez_setup.py
Once this is done you can use easy_install to automatically fetch and install something from Python package index.
$ easy_install TurboGears