Set up modern Python environment

This is on Ubuntu, designed to get the basics installed system-wide and ready to use in virtualenvs, with minimum mess left behind:

# modern distributions already have (old) pip, use the first two lines if you don't
# sudo aptitude install python-setuptools # sudo easy_install pip pip install -U --user pip virtualenv virtualenvwrapper ipython ipdb
# optional
pip completion --bash >> ~/.bash_completion

Also, add the following lines to .bashrc:

source ~/.local/bin/virtualenvwrapper.sh
export PROJECT_HOME=~/dev
export PATH=~/.local/bin:$PATH

Then you can use pipmkproject and workon etc. conveniently. I think there may still be an issue with ipython inside virtualenvs, but I’ll get to that when I encounter it (again).

EDIT: virtualenvwrapper.project has been merged into virtualenvwrapper so installing it now causes conflicts. Removed from the list.

EDIT: PIP_RESPECT_VIRTUALENV is removed since pip 1.1 because pip is installed in every virtualenv.

EDIT: tidy up commands for more recent distributions.

EDIT: pip now has a --user option to have user-wide installation of packages. Some distros have not added ~/.local/bin to their $PATH. pip and virtualenv now have better defaults, so settings WORKON_HOME and PIP_VIRTUALENV_BASE is not necessary.