On Java, Python, Groovy, Grails, Spring, Node.js, Linux, Arduino, ARM, Embedded Devices & Web

  • Recent Posts

    December 2011
    M T W T F S S
    « Oct   Feb »
  • Subscribe Options

  • Awards

  • Most Valuable Blogger @ DZone
  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 175 other followers

  • Follow MyThinkPond on
  • Blog Stats

    • 366,804 hits
  • General Options

How to upgrade to Python 2.7 on CentOS

Posted by Venkatt Guhesan on December 28, 2011

If you tried upgrading to Python 2.7 on CentOS, you will quickly find out that the RPM’s don’t exist for this in the repos. So here’s a short summary of what I did to upgrade my Python to 2.7 on CentOS.

Based on a few Google searches… I discovered that a few dependent packages are required before you try upgrading to Python 2.7.

yum -y groupinstall 'Development Tools'
yum -y install openssl-devel* ncurses-devel* zlib*.x86_64</pre>
yum -y install bzip2 bzip2-devel bzip2-libs

Next download the latest tar/gzip/tgz available here:

#Download the latest available at this time
curl -O
#Unzip/expand file
tar xfz Python-2.7.tgz
#Change Directory to the unzipped folder
cd Python-2.7
#read README file or you can follow the lines below
#you could also run configure with threads and shared enabled
#./configure --prefix=/opt/python2.7 --with-threads --enable-shared
make install
# Exit from your shell and open a new shell/SSH session
# Use the command below to display which path of python is currently active
which python
#To verify if the install succeeded
python -V
#Use UPPERCASE 'V' - not lower-case.
#Output will be "Python 2.7"
#Sometimes you may need to exit out of your shell
#and them come back in to see the version changes.
#So best exit your current shell prompt and reopen
#a new before checking the version.

You’re all set. You’ve just upgraded to Python 2.7.

The next logical step that you need to perform is to install the setup tools that allows you to install modules. (Please note that setuptools is not available for Python 3.0+, instead use Distrubute available here –

Download the latest setuptools for your version of Python (2.7 in this case) from here:

curl -O

chmod 775 setuptools-0.6c11-py2.7.egg

sh setuptools-0.6c11-py2.7.egg

#This should install the egg here: /usr/local/lib/python2.7/site-packages/

Next you want to install “PIP”, this enables the download and install of modules in Python:

$ curl -O
$ tar xvfz pip-1.0.tar.gz
$ cd pip-1.0
$ python install # may need to be root</pre>

Now you’re all set. Suppose you wanted to install a module called ‘simplejson’.

You can now do this using command syntax like this:

pip install simplejson



10 Responses to “How to upgrade to Python 2.7 on CentOS”

  1. […] to upgrade Python2.4 to Python2.6. Actually it was a lot easier then I thought. There is the link: Install Python 2.7 Share this:TwitterFacebookLike this:LikeBe the first to like […]

  2. Scott Anderson said

    This is *very* helpful! I had figured out on my own how to upgrade to python2.7, since there is advice out there on how to do so, but yours was the only site that told me how to install the easy_install and pip functionality, which is the gateway to everything else in Python. Thanks so much!

  3. bhatia said

    Great, worked very well, and saved me a lot of effort

  4. […] for several servers already. Actually it was a lot easier then I thought. Credits to this link: Install Python 2.7 Here are essential steps. Before really installing Python 2.7, you might need to update other […]

  5. Matti Pentti said

    If you need to fall back to 2.4 or other versions, or just need to test multiple Python versions. Switching is easy between versions with “pythonbrew”.
    yum install python-setuptools
    easy_install pythonbrew
    pythonbrew install 2.7.3
    #pythonbrew install 3.3.0
    pythonbrew switch 2.7.3
    pythonbrew list

  6. […] […]

  7. […] If you get stuck you may need to install the Developers Tools and other libraries. Take a look here for more info […]

  8. tim-gp said

    it just works! good collection BTW

  9. iodine said

    Awesome – Thank you.

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: