Install Build Requirements
If you have the appropriate deb-src entries in your sources.list files, then you can do this:
apt-get build-dep python2.5
Replace 2.5 with the default version in your distro. Unfortunatly in sidux this wanted to install emacs (NEVAR!!!!) and remove my password manager (the unstable repo has been changing rapidly since the new debian release). I used this instead:
apt-get install build-essential blt-dev libbluetooth-dev libbz2-dev libdb4.5-dev  libffi-dev libgdbm-dev libncurses5-dev libncursesw5-dev libreadline5-dev libsqlite3-dev libssl-dev tk8.4-dev
It worked for me, but the list may be incomplete.
Install Python, libraries, etc
See my article about installing 2.6 in Cent OS – most of it is distribution agnostic. To build/install psycopg2 you will probably need to install libpq-dev.