Source

If your system does not provide python 2.7 (ask your system administrator or check the system documentation to be sure), it can be compiled from source. The following steps are not trivial and can not work out of the box because it will depend on your system and the already installed libraries.

  • Compile python:
mkdir -p $HOME/shared/
mkdir -p $HOME/shared/src/

cd $HOME/shared/src/

wget ftp://ftp.cwru.edu/pub/bash/readline-6.2.tar.gz
tar -zxvf readline-6.2.tar.gz 
cd readline-6.2/
./configure --prefix=$HOME/shared/
make
make install
cd ..

wget --no-check-certificate https://www.sqlite.org/2015/sqlite-autoconf-3080900.tar.gz
tar -zxvf sqlite-autoconf-3080900.tar.gz 
cd sqlite-autoconf-3080900
./configure --prefix=$HOME/shared/
make
make install
cd ..

wget ftp://ftp.tcl.tk/pub/tcl/tcl8_5/tcl8.5.17-src.tar.gz
tar -zxvf tcl8.5.17-src.tar.gz 
cd tcl8.5.17/unix
./configure --prefix=$HOME/shared/ --enable-threads
make
make install
cd ../../

wget http://downloads.sourceforge.net/project/tcl/Tcl/8.5.17/tk8.5.17-src.tar.gz
tar -zxvf tk8.5.17-src.tar.gz
cd tk8.5.17/unix
./configure --prefix=$HOME/shared/ --enable-threads
make
make install
cd ../../

wget -c https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz
tar -zxvf Python-2.7.9.tgz
cd Python-2.7.9
./configure --enable-shared --prefix=$HOME/shared/
make
make install
cd ..
  • Edit //$HOME/.bashrc// and add:
export SANDBOXPATH=$HOME/shared
export PATH=$SANDBOXPATH/bin:$PATH
export PYTHONPATH=$SANDBOXPATH/lib/python2.7/site-packages:$PYTHONPATH
export LD_LIBRARY_PATH=$SANDBOXPATH/lib:$LD_LIBRARY_PATH
export PKG_CONFIG_PATH=$SANDBOXPATH/lib/pkgconfig:$PKG_CONFIG_PATH
unset CPPFLAGS
unset LDFLAGS
#export CPPFLAGS="-I$SANDBOXPATH/include"
#export LDFLAGS="-L$SANDBOXPATH/lib"
  • Close all the terminals and open a new one. If the user's default shell is bash, in order to load the new configuration you can instead execute:
source $HOME/.bash\_profile
  • Then follow the same instructions listed in the section APT - VirtualEnv (ignoring the apt part).