Installing Python 2.7 on CentOS 5

CentOS comes with python 2.4, which should not be replaced by other versions of Python. To install a different version of Python, I followed the instruction here:

Note that you may need root or sodu to use the instruction in the following.

There are some tips about virtualevn and virtualevnwrapper, which is not described in detail in the aforementioned link. Please refer to the following links.

Actually, I install Python 2.7 to use matplotlib. When I was trying to install matplotlib, I found there were some libs missing. Here is a link about the libs needed for matplotlib.

Somehow, I managed to set up the virtualenv for my python 2.7. I install it in /usr/local/bin, and my ~/.bashrc looks like this:

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc

# User specific aliases and functions
export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python2.7
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/

I set up a virtual environment called p2.7. To use it, simply used command

workon p2.7

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