CentOS 6 with Python 2.6.7: Yum broken: No module named yum

yum-logoThis article shows how to solve the error when installing Python 2.6.7 on CentOS 6: “Yum broken: No module named yum”.

When installing the dropbox service in Linux command line, I did compile python 2.6.7 from source, and after that, the yum command line stopped working. As you can see, it is terrible case as I cannot install/update program by yum any more.

So here is the operation system:

[[email protected] ~]# cat /etc/redhat-release
CentOS Linux release 6.0 (Final)

And here is the problem:

#yum
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   No module named yum

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
...

Searching over the Internet for this case is really hurt, since there are too many “noised” topics regarding this. So, I finally can overcome this as follows:

The installer for the python2.6 I compiled did something like that on the way

echo "/usr/local/lib" >>/etc/ld.so.conf.d/python26-lib.conf
/sbin/ldconfig

Which links shared libraries for python to /usr/local/bin.

Seeing this, it was easy to switch back to the original python libaries

echo "/usr/lib64" >>/etc/ld.so.conf.d/python26-lib.conf
/sbin/ldconfig

And, bravo, yum is back

Leave a Reply