Install a different python version then the one coming with your ubuntu version. We will be using the deadsnakes ppa to install the python versions.

[AdSense-B]

First we need to add the deadsnakes PPA to your repositories:

sudo add-apt-repository ppa:fkrull/deadsnakes

After this you need to update your apt:

sudo apt-get update

Now you will be able install older python versions on Ubuntu 13.04 or newer versions on Ubuntu 10.04.

[AdSense-A]

For example we will be installing Python 2.5 on Ubuntu 12.04:

sudo apt-get install python2.5