6 Answers
6

Just do the usual rpmbuild --rebuild ... to create the binary rpms. It does not interfere with the installed 2.4 version, it coexists with it. but you do have to put the specific version in your scripts: #!/usr/bin/python2.7. But if you use setuptools invoked with that version then it happens automatically.

Is it ok if you have the rpm instead of a repo (i.e. can you take care of dependencies if it arises?). If so, try phone or rpmfind. If none of the above helps, consider building from source tar balls. By far that will be the easiest.

What do you mean by this By far that will be the easiest? What are you comparing it to?
–
TshepangJul 9 '11 at 16:58

@Tshepang, i comparing in terms of time needed/spent for fixing this type of typical case of dependency related issue. I am not saying about depency arasing out of this python package but the original dependency arised to get this particular version of python. I have faced this many times during my initial linux newbie days and have always at the end come to the conculsion that source tar ball is the fastest and hence the easiest way to solve this kind of problem. But that was years ago and now situation have vastly improved with automatic dependency resolution. But still work a try.
–
Naai SekarJul 10 '11 at 5:28

The IUS community project looked very promising. But it looks like they stopped efforts. Python 2.6 is the most recent there. iuscommunity.com. I still hope that one day the PSF will start sponsoring a Yum/PPA repo for RHEL/CentOS/Ubuntu.
–
PaidhiMar 26 '12 at 11:41

You can try to get 2.6 srpm from epel you've found, extract spec file from it, change version number and rebuild it.

However, be carefull: there are a lot of packages depending on python 2.4 on el5 (like yum). You'll probably need to ensure that you are installing 2.4 and 2.7 at the same time or that you've rebuild everything depending on 2.4.

I have successfully used python 2.6 together with 2.4 without problems. The only conflict was found with mod-wsgi -- it depends on python-dev, so you cannot use two mod-wsgi's simultaneously (I had to make a custom RPM for mod-wskg-python26)
–
grepJul 11 '11 at 10:32

Not that I am aware of. However, you can find .spec files on the net to build parallel python versions where all the RPM files are named python27-whatever etc. Then the default python executable is still your vendor one, which should not be changed or you may break very important things, like rpm itself (I speak from experience).

Note that starting with RHEL5 (I have no experience with 6), rpmbuild will "precompile" python in any RPM. It's a known bug that they refuse to fix that it will mess up the %files section. Anyway, the problem is that the files will be precompiled with the stock OS python, which is really annoying because then you get "Bad Magic Number" errors if you try to use them. You need to change some RPM config scripts, but I don't have the info in front of me.