1

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

But

[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

3 Answers 3

4

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.)

0

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

-2

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.

2
  • isn't there a pretty obvious default reason to upgrade Python? He must want to run some 2.6-only code. Jul 20, 2010 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, 2010 at 8:16

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.