1

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 ?

monkey
  • 13
  • 2

2 Answers2

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

Chad Feller
  • 776
  • 5
  • 6
  • 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](http://download.fedora.redhat.com/pub/epel/5/x86_64/repoview/python26-mod_python.html), it sounds like it will only load if mod_python isn't already loaded. More details can be found [here](https://bugzilla.redhat.com/show_bug.cgi?id=638362). 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
1

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
make install

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

udienz
  • 11
  • 1