tags:

views:

9590

answers:

7

I have a shell that runs CentOS For a project I'm doing I need python 2.5+ but centOS is pretty dependent on 2.4 From what I've read a number of things will break if you upgrade to 2.5 I wan't to install 2.5 separately from 2.4 but I'm not sure how to do it. So far I've downloaded the source tarball, untarred it and did a ./configure --prefix=/opt which is where I want it to end up. can I now just make, make install ? or is there more?

+2  A: 

If you want to make it easier on yourself, there are CentOS RPMs for new Python versions floating around the net. E.g. see:

http://www.geekymedia.com/python%5F26%5Fcentos.html

oggy
+6  A: 

No, that's it. You might want to make sure you have all optional library headers installed too so you don't have to recompile it later. They are listed in the documentation I think.

Also, you can install it even in the standard path if you do make altinstall. That way it won't override your current default "python".

Lennart Regebro
+1: `sudo make altinstall`
J.F. Sebastian
+6  A: 

Chris Lea provides a YUM repository for python26 RPMs that can co-exist with the 'native' 2.4 that is needed for quite a few admin tools on CentOS.

Quick instructions that worked at least for me:

$ sudo rpm -Uvh http://yum.chrislea.com/centos/5/i386/chl-release-5-3.noarch.rpm
$ sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CHL
$ sudo yum install python26
$ python26
Kimvais
This didn't work under CentOS 5.4:No package python26 available.
Joseph Turian
Didn't work on CentOS 5.5: Missing Dependency: libffi.so.5
Ondra Žižka
+9  A: 

When I've run into similar situations, I generally avoid the package manager, especially if it would be embarrassing to break something, i.e. a production server. Instead, I go to Activestate and download their binary package:

https://www.activestate.com/activepython/downloads/

This is installed by running a script which places everything into a folder and does not touch any system files. In fact, you don't even need root permissions to set it up. Then I change the name of the binary to something like apy26, add that folder to the end of the PATH and start coding. If you install packages with apy26 setup.py installor if you use virtualenv and easyinstall, then you have just as flexible a python environment as you need without touching the system standard python.

Michael Dillon
+1  A: 

you can always make your own RPM:

http://www.grenadepod.com/2009/12/26/building-python-2-6-4-rpm-for-centos-5-4/

pulegium
+1  A: 

Late to the party, but the OP should have gone with Buildout or Virtualenv, and sidestepped the problem completely.

I am currently working on a Centos server, well, toiling away would be the proper term and I can assure everyone that the only way I am able to blink back the tears whilst using the software equivalents of fire hardened spears, is buildout.

chiggsy
can you use virtualenv to install python2.6 when only python2.4 is installed?
Collin Anderson
Certainly. Use --no-site-packages option in virtualenv I believe, or build a python in buildout.
chiggsy
+4  A: 

I've run in the same problem and here a very good guide on how to do that

http://blog.boxedice.com/2010/01/19/updating-python-on-rhelcentos/

Damien