How to install Python 2.7 on RHEL 5

Today, I was trying to install MeldMerge tool on RHEL 5 server and got errors as the system is running and using currently installedPython 2.4 version. This application requires Python 2.7, Python 2.4 is installed and available by default on RHEL 5 and we cann’t remove as other application’s are already using it. This tutorial will help you to install Python 2.7 without removing older versions. We will install Python 2.7 side by side on the system and you will be able to use both of them.

su
cd /usr/src
wget https://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz --no-check-certificate
tar -zvf Python-2.7.6.tgz
rm -rf Python-2.7.6.tgz
cd Python-2.7.6
./configure --prefix=/opt/python2.7 --enable-shared
make
make altinstall

Python 2.7.6 is now installed on the system in /opt/python2.7 directory and is ready to be used. Before you can use this new version for you app, you will need to export the PATH into new Python install. If you want to keep it as default-permanent add it into your .bashrc file.

Here is how to export PATH and point to the right directory

export PATH=$PATH:/opt/python2.7/bin/

Done!

Leave a Reply