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 fi # User specific aliases and functions export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python2.7 export WORKON_HOME=$HOME/.virtualenvs source /usr/local/bin/virtualenvwrapper.sh
I set up a virtual environment called p2.7. To use it, simply used command