Python 2.7 on CentOS 6.2 with Setuptools

First check the python version that is currently install on CentOS 6.2:


Before installing the python, please install these packages:

sudo yum install gccgcc-c++.x86_64 compat-gcc-34-c++.x86_64 openssl-devel.x86_64 
zlib*.x86_64 wget make setuptool

Now download the Python 2.7 (In my case, I will download it in tmp directory):

cd /tmp/

Switch to the super user (root):


Extract the downloaded Python 2.7 package:

tar -xvjf Python-2.7.tar.bz2

Move to the Python 2.7 directory and configure the package:

cd  Python-2.7

It’s time to actually build the binary from the source code:


Now it’s finally time to install the program:

make install

Edit the user .bash_profile file:

nano ~/.bash_profile

replace PATH=$PATH:$HOME/bin
with PATH=$PATH:$HOME/bin:/opt/python27/bin

Reload the .bash_profile:

source ~/.bash_profile
echo "/opt/python27/lib" > /etc/

Check the Python version now🙂


Now, we will install the setuptool and for this we need to fetch the setuptools from the website:

cd ..

Run the setuptools using this command:

sh setuptools-0.6c11-py2.7.egg

Next, we will install the gevent:

yum install libevent.x86_64 libevent-devel.x86_64



tar -xvzf gevent-0.13.0.tar.gz

cd gevent-0.13.0

python2.7 install

Logout from root user and check the python version for user arbab:


Hope this will help you!

Please Remember me in your prayers!

4 responses to “Python 2.7 on CentOS 6.2 with Setuptools

  1. Alex August 13, 2012 at 9:15 pm

    Good post. worked for me. Thanks!

  2. Desai August 21, 2012 at 5:25 am

    Spot on. Worked like charm

  3. suneth April 29, 2013 at 5:42 pm

    How to uninstall python 2.7 and go back to python 2.6.6 ?

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: