How to upgrade python on Redhat?
davidf at sjsoft.com
Wed Mar 9 09:36:30 CET 2005
penglish1 at gmail.com wrote:
> This question applies specifically to RHEL 3.0 (actually Whitebox), but
> also generally to Redhat and probably pretty much every distribution
> that uses python for distribution-related tasks (configuration
> managers, rpm package management, yum, etc).
> So I want to upgrade to python 2.4 on Whitebox 3.0. Ideally I would
> like python to live in /usr/bin and replace the python 2.2 that ships
> with RHEL entirely. This gets pretty infeasable when you consider how
> many packages depend on python 2.2:
> cd /usr/lib/python2.2/site-packages
> rpm -qf * | sort | uniq
> file Ft is not owned by any package
> file _xmlplus is not owned by any package
> As best I can tell, I have 2 options:
> 1) Install python 2.4 from source over /usr/bin/python. Rebuild *all*
> of the packages listed above from srpms and reinstall them.
> 2) Give up and install python 2.4 in /usr/local. This leaves me in the
> awkward situation of having to ensure that all our in-house scripts,
> all the time use /usr/local/bin/python.
> I don't suppose there is a simple, rpm package based approach to fixing
The solution is found on the download page, basically you get the
python2.4 rpm and install it alongside your existing python, and run
your in-house scripts with /usr/bin/env python2.4:
# Q) Is it safe to install these RPMs on a Red Hat system? Will they
over-write the system python and cause problems with other Red Hat
applications that expect a different version of Python?
# A) The RPMs that start with "python2.4" are built to not interfere
with the system Python. They install as "/usr/bin/python2.4" and will
not conflict with the system Python unless you are running on a system
that ships the a version of Python which has the same major/minor number.
To invoke the interpreter with these packages, you will explicitly have
to run "python2.4". Note that all Python RPMs provided by Python.org and
Red Hat provide a "/usr/bin/python2.4" (or similar, with major/minor
number), even if they also provide "/usr/bin/python". So, yes, it should
Note that you may need to build and install a second copy of any
packages which you need access to with the supplemental version of
Python. You can build packages of these files for the Python 2.4
interpreters for packages which use Distutils, by using the command
"python2.4 setup.py bdist_rpm".
More information about the Python-list