I am using a software package called Stampy to map illumina sequencing reads against the reference genome for my project. In order to install Stampy, a Python of version 2.6 or 2.7 is prerequisite. The default version of Python on our computing cluster, SUG@R, is 2.4.3 and the optional version is 3.2.1, so neither of them can work with Stampy. So I need to install Python 2.7 on SUG@R by myself. The step is as follows>>

1) Under my SUG@R $HOME directory, download Python 2.7 source code and decompress it.

wget http://python.org/ftp/python/2.7.2/Python-2.7.2.tgz
tar -xzvf Python-2.7.2.tgz

A new directory named Python-2.7.2 will be created now.

2) Enter this directory and  use the “–prefix” argument to configure Python with the preferred install directory (should not be the same directory as the one containing the Python source code, I set as “/users/NetID/local/Python-2.7.2/” here). Then just type “make” and “make install” commands. Now, Python 2.7 is installed successfully under our specified directory.

cd Python-2.7.2
./configure -prefix=/users/NetID/local/Python-2.7.2
make install

3) The last step will be set the PATH environment variable to the installation directory’s bin/ subdirectory. Since I want our installed Python 2.7.2 to permanently override the default version of Python on SUG@R, I will just edit the .bash_profile file under my $HOME directory and add the following lines.

# User specific environment and startup programs
export PATH

4) Then we are done! Just re-login and type which python and see what we’ve got :)

which python