By default centos 6.x comes with Python 2.6 as default, Since python 2.6 is used internally by the os you cant replace it with python 2.7. In this tutorial, I will show you how to install python 2.7 and pip in centos 6.x server along with python 2.6.

Download Python 2.7 Source

cd /usr/src

Compile and Install Python 2.7

tar xzf Python-2.7.10.tgzcd Python-2.7.10
make altinstall

Create 2.7 Python shortcut in /usr/bin

ln -s /usr/local/bin/python2.7 /usr/bin/python27 

Install pip for Python 2.7

cd /usr/src
curl -o
ln -s /usr/local/bin/pip /usr/bin/pip27 

Check If python 2.7 is installed correctly

python27 -V 

Test pip27 by installing flask package (optional)

pip27 install flask

shyam jos

My name is Shyam Jos, I am a passionate Linux system administrator from Kochi, India. I am a strong advocate of using Linux and Open-Source software.

1 Comment

Joe Tairei · May 22, 2019 at 6:35 PM

Thanks; this worked perfectly 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.