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:
gcc -v
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.
mkdir $HOME/usr
Now go to the Python folder we just downloaded
cd $HOME/Downloads/Python-2.7.5
We need to set the installation prefix so the files will be compiled in the folder we have created previously
./configure --prefix=$HOME/usr
Finally we just have to run the following commands
make
make install
Now we can remove the folder /home/yourUser/Downloads/Python-2.7.5 cause python as been succesfully installed in “/home/yourUser/usr“.
Comments 1
Pingback: Configure python development environments in Sabayon (Gentoo) | Zend Developer