How do I safely install an older/newer version of Python? [duplicate]

When I eventually upgrade to 11.04 I will need to install Python 2.6 for development purposes. The 11.04 default is 2.7. Can I just install the python2.6 package alongside the default python package? I don't want anything else to depend on it, I need it for only one purpose. I will be using Distribute and virtualenv to install any further dependencies for Python 2.6.


Solution 1:

Run synaptic(through the application lens in unity or System -> Administration if you are using classic desktop )

search for python 2.6 in the filter at the top and mark it for installation by right clicking it, and selecting "Mark for Installation".

It should run alongside 2.7 fine as far as I'm aware, now when you need to use 2.6 invoke it directly, i.e with the command "python2.6 "

This should work, let me know if it doesn't though. :)

Solution 2:

VirtualEnv is the definitely best way to have multiple python versions, even it it is the same interpreter but with different installed libraries. In each virtual environment you will run the selected python version. Every thing will be transparent.

BTW: you can find a repository with very old python version here: https://launchpad.net/~fkrull/+archive/deadsnakes/+packages

Maybe it will be useful for someone.