1

On Redhat, I had the bright idea of upgrading from Python 2.6.6 to 2.7.3 by running this command:

cp /usr/bin/python2.7 /usr/bin/python

This caused far-reaching problems throughout the whole system. The most notable of these is the fact that the yum installer depends on python.

I re-downloaded 2.6.6 from online and replaced it in /usr/bin/python. Now when I run python -V I'm running 2.6.6. However, when I run python and type import yum; the package can't be found.

Is it still installed somewhere on my system? How can I fix this? It's a colossal disaster.

I'm running Red Hat 4.4.7-16.

2

Use RPM to reinstall the Python 2.6 package. This should reset all the dependencies and rpm isn't dependent upon python.

First get a copy of the Python rpm from install media or official online Red Hat or CentOS repositories.

On my CentOS 6 host, the package is python-2.6.6-52.el6.x86_64. Your package may be different based upon platform and OS release.

sudo rpm -Uvh --replacepkgs python-package.rpm

As you have found, it's generally a bad idea to modify rpm managed executables. There are several discussions on the Internet on upgrading Python to 2.7 under RHEL/CentOS. You might want to start there.

1
  • Noting "4.4.7-16" isn't a Red Hat (or CentOS) version, but is likely the gcc version used in RHEL6/CentOS6. – mr.spuratic Oct 24 '17 at 16:17

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.