-
Notifications
You must be signed in to change notification settings - Fork 32
Setting up virtualenv
In environments where you don't have root access virtualenv and virtualenvwrapper can be extremely useful to satisfy dependencies and easily switch between different environments.
Add the following lines to your ~/.bashrc, where VENVPATH should be replaced with the full path to where you intend to keep everything associated with the virtual environments and all references to Python should be replaced with the version you'll be using.
# User specific aliases and functions
export VENVPATH=$HOME/opt
export PATH=$PATH:$VENVPATH/Python/bin
export PYTHONPATH=$VENVPATH/Python/lib/python2.6/site-packages
source /VENVPATH/Python/bin/virtualenvwrapper.sh
export WORKON_HOME=$VENVPATH/.virtualenvs
Then execute the following, again replacing all references to Python 2.6 with the system version:
$ export VENVPATH=$HOME/opt
$ source ~/.bashrc >& /dev/null && mkdir -p $VENVPATH/Python/lib/python2.6/site-packages
$ easy_install --prefix=$VENVPATH/Python pip
$ pip install virtualenvwrapper --install-option="--prefix=$VENVPATH/Python/" && source ~/.bashrc
$ mkvirtualenv --python=python2.6 --no-site-packages topo
Or with your custom Python build:
module unload python && mkvirtualenv --no-site-packages --python=..../bin/python topo
Overview of living with virtualenv and using GitHub
Making life even better: Virtualenvwrapper
Installing virtualenvwrapper without root access.
Virtualenv hooks, allow you to add hooks when activating or deactivating an environment (e.g. switch to the topographica directory).