Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have python 2.4 and 2.6 installed on my RHEL5 machine.


[de22596 gnuradio]:+ss$ python -V
Python 2.4.3

I tried to make a symlink from in /usr/bin python -> python26, then I get

[de22596 gnuradio]:+ss$ python -V
Python 2.6

But a lot of things break, like yum. How can I fix this?

Right now, I have this:

[de22596 bin]:$ ls -l python*
lrwxrwxrwx 1 root root    9 Jul 20 10:52 python -> python2.4
lrwxrwxrwx 1 root root    6 Jul 12 15:02 python2 -> python
-rwxr-xr-x 2 root root 8304 Jun 11  2009 python2.4
-rwxr-xr-x 2 root root 8328 Apr  9 11:17 python26
-rwxr-xr-x 2 root root 8328 Apr  9 11:17 python2.6
-rwxr-xr-x 1 root root 1418 Apr  9 11:17 python2.6-config
-rwxr-xr-x 2 root root 8304 Jun 11  2009 python.back
lrwxrwxrwx 1 root root   16 Jul 20 10:34 python-config -> python2.6-config

Could I do

yum remove python2.4

And expect things to still work? I'm worried because yum is a python script, so if I remove python2.4 will it be smart enough to

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

Unfortunately, you cannot remove Python 2.4 from RHEL5, unless you're able to remove (or patch) dozens of Python scripts that only work with 2.4, not 2.6. You can easily install 2.6 in parallel with 2.4 (as you already know), but removing 2.4 is "major surgery". You can certainly try, but most users/operators just don't bother.

As another poster noted, '/usr/bin/python26' is in your default PATH, just like '/usr/bin/python'. On the command line, you can just call 'python26' instead of 'python'. In your 2.6-specific scripts/programs, you can replace your she-bang lines with '#!/usr/bin/python26'.

Handling 2.6-only modules is a bit harder. You'll need to move them from '/usr/lib/python/...' to '/usr/lib/python26/...'. If you're lucky, somebody may have already packaged a variant specifically for Python 2.6 on RHEL5 with the paths changed, or you can modify and rebuild existing RPMs, yourself.

The problem is that the transition from Python 2.4 to 2.6 introduced a few backward-incompatibilities. So a lot of scripts authored with 2.4 in mind won't run properly under 2.6 without some patching. (There are people who claim that 2.6 IS backwards compatible... it's close, but not 100%.)

Recent Fedora releases and the RHEL6 beta ship more advanced Python versions (2.5+), along with updates to dozens (possibly hundreds) of Python scripts, too. But Red Hat decided to keep its EL5 branch on Python 2.4, probably due to the risk of breaking any Python 2.4-only scripts running on clients' machines. (This is a pretty standard practice for a long-term-stable distro series like RHEL.)

share|improve this answer
add comment

Simple. Don't do that. Either modify the shebang line of the appropriate scripts, or invoke python26 directly.

share|improve this answer
add comment

i know this isnt going to come over as overly helpful, but why are you needing to upgrade python ? - RHEL5 is aimed at stability and hence there's an inherant tradeoff in the ability to harness newer releases.

share|improve this answer
isn't there a pretty obvious default reason to upgrade Python? He must want to run some 2.6-only code. –  Ryan B. Lynch Jul 20 '10 at 16:15
well yes. The point i was trying to make is the reason rhel5 makes doing what he wants to do such a pain is that it's not designed to be used in such a way. –  Sirex Jul 21 '10 at 8:16
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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