Installing different verions of Python locally is very usefull wen using Virtualenv, so we can swap from one version to another just typing one command. We’ll need the compiler so first we need to check if it’s actually installed:
If it’s not installed you can get it as follows:
sudo equo install sys-devel/gcc-4.7.3
Get the version of python you want to install from http://www.python.org/download/. In this example I’m downloading “Python 2.7.5”. Once it’s downloaded we have to uncompress the file, for example in “/home/$USER/Downloads/Python-2.7.5“.
Now we need to go to the terminal and create a folder to install our local versions of python.
Now go to the Python folder we just downloaded
We need to set the installation prefix so the files will be compiled in the folder we have created previously
Finally we just have to run the following commands
Now we can remove the folder /home/yourUser/Downloads/Python-2.7.5 cause python as been succesfully installed in “/home/yourUser/usr“.