Debian – How to install Python 2.6 on Debian 5.0 (lenny) using apt-get

debiandebian-lennypython

After some digging and experimentation, I figured out how to install Python 2.6 on Debian 5.0 using apt-get. So I thought it best to post on SF as a question and answer. I know this can be manually built and installed, but many people prefer to use apt-get (including myself).

Best Answer

This is a good way to break your system; you'll wind up upgrading all sorts of stable things to unstable, and you'll have trouble from then on, because Debian isn't designed to run on a system that's halfway stable and halfway unstable.

A better way is a backport, but it's not straightforward to backport 2.6 to lenny apparently.