Apologies in advance for the Ubuntu-centricity of this post title. I haven't had a chance to try this out on Debian, so I can't be sure that it works quite as smoothly, although I assume it does. All of this was done on Ubuntu 9.10 (Karmic Koala).
First, install python, the python development headers and libraries, and python's setuptools (setuptools includes easy_install). easy_install allows you to install python libraries that are not available via the Ubuntu package system.
sudo aptitude install python python-all python-dev python-all-dev python-setuptools
Second, use easy_install to install pip, which is superior to easy_install for package and library management. We use easy_install to get the latest version of pip, which is not available in the Ubuntu packages. Since it's not installed with aptitude, pip will end up under /usr/local as it should.
sudo easy_install pip
Finally, use pip to install virtualenv, which allows you to build out environments containing specific versions of python libraries for specific applications and development environments.
sudo pip install virtualenv
At this point I don't have hard and fast rules for which method I use to install python dependencies, but roughly it's:
Use aptitude and the Ubuntu sources for stable packages and tools, or packages and tools which are linked to other functionality and libraries better handled with the system package management. e.g. I'd install MySQL database support for python with the python-mysqldb package.
Use pip to install to /usr/local for tools which are useful system wide and are either out of date or not available in the Ubuntu sources. e.g. pep8.
Use pip to install to a specific virtualenv for a specific application development. e.g. if I started a Django project which had some specific dependencies I'd set up a virtualenv for that project and install the libraries it depended on there.
For more on why you might want to use these tools for python development:
And thanks to Andrew who (unbeknownst to him) was the trigger for me writing this post. He also took the time to walk me through pip and virtualenv a few weeks ago.