How to install two Python versions in Dragora
First of all you need to download the virtualenv. You can do it with these commands:
Code:
$ curl -O https://pypi.python.org/packages/source/v/virtualenv/virtualenv-X.X.tar.gz
$ tar xvfz virtualenv-X.X.tar.gz
$ cd virtualenv-X.X
$ [sudo] python setup.py install
If you want to find the last version of virtualenv go to virtualenv and find the latest version,then replace the virtualenv-X.X.tar.gz of the first command with the latest version. For instance, if you want to install the version 1.9 then you have to hit the follow command:
Code:
curl -O https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.9.tar.gz
If you think you have installed
virtualenv successfully you can hit:
Code:
virtualenv --version
so, if you see the right version (in our example 1.9) then it's ok!
The next step is a “peace of cake” don't worry, download python from this
https://www.python.org/ftp/python/ , in our example we downloaded the version 2.7.6. Thus you can only hit the following commands:
Code:
tar -zxvf Python-2.7.6.tar.gz
cd Python-2.7.6
mkdir ~/.localpython
./configure --prefix=/home/<user>/.localpython
make
make install
Perfect, now you have two versions of python in your system.
Attention!! if you hit
you will see the previous version of python and this is right. Think again, we just installed the new python in
~/.localpython and not in the default path
(/usr/bin). So if you want to enable new python then just hit:
Code:
virtualenv ve -p /home/<user>/.localpython/bin/python2.7
source ve/bin/activate
or
Code:
alias python=/home/<user>/.localpython/bin/python2.7
Again hit:
Great!! You have just enabled the python 2.7