CentOS 5.x comes with python 2.4 preinstalled. I'd like to use a newer version, but I don't want to break anything.

How should I install a newer version without causing problems?

How can I force mod_python to use newer python, instead of 2.4 ?


Python 2.6 is available via EPEL. To enable EPEL for your box, just do a:

rpm -ivh http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm

Then, to install Python 2.6:

yum install python26

there is also a mod_python from there too:

yum install python26-mod_python

To find additional packages: yum search python26

  • will it replace the system's version? I think this can break something. – monkey Aug 27 '11 at 18:22
  • No, it installs in parallel as python26. – Chad Feller Aug 27 '11 at 18:23
  • python26-mod_python will automatically replace mod_python ? – monkey Aug 27 '11 at 18:38
  • By default, according to the changelog, it sounds like it will only load if mod_python isn't already loaded. More details can be found here. So it sounds like you will have to either remove the old mod_python (yum remove mod_python), or prevent it from loading (edit /etc/httpd/conf.d/python.conf) to use python26-mod_python. – Chad Feller Aug 27 '11 at 18:53

You can compile python2.x with another user (i use py26 as username) by

wget http://www.python.org/ftp/python/2.6.7/Python-2.6.7.tgz
tar xzvf Python-2.6.7.tgz
cd Python-2.6.7
./configure --prefix=$HOME/python
make install

then add $HOME/python/bin to $PATH, so python2.6 only used by py26 user

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.