Upgrade / install a different version of Python in CentOS !

The Python version which comes along with CentOS is usually 2.4.x, which is way behind and some of the applications / scripts would require a newer version of Python.

Upgrading Python in a cPanel environment using yum is not preffered as it may break services / managers including yum which is dependent on Python.

The best option will be to install a different version of Python at a different location. The default Python binary will be at /usr/bin/python. We can install the newer one at an alternate location. Following steps will help you :

cd /usr/src

wget https://www.python.org/ftp/python/3.0/Python-3.0.tgz

( You can download a different version if you prefer, just go to the above URL – deleting upto /3.0.. and check for the versions )

tar -xvzf Python-3.0.tgz

cd Python-3.0

./configure –prefix=/usr/local

make

make install

Now, Python3.0 will be installed in /usr/local and the binary will be available at /usr/local/bin/python3.0 and you can use this path as reference to scripts / apps which require the newer version.

That’s it !