Any yum command I try to run, returns the following:
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
cannot import name Errors
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:
2.6.6 (r266:84292, Aug 18 2016, 15:13:37)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)]
If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq
This is what I've done and what I know:
OS is Red hat 4.4.7018
I believe Python was 2.6 and was updated to 2.7 some time ago (I suspect this might have broken yum)
python -V
returns 2.7.13
# ls -lrt /usr/bin/python*
-rwxr-xr-x. 1 root root 4864 Aug 18 2016 /usr/bin/python2.6
lrwxrwxrwx. 1 root root 6 Mar 8 13:16 /usr/bin/python2 -> python
lrwxrwxrwx. 1 root root 24 Mar 8 13:32 /usr/bin/python -> /usr/local/bin/python2.7
# ls /usr/bin/python*
/usr/bin/python /usr/bin/python2 /usr/bin/python2.6
# ls /usr/local/bin/python*
/usr/local/bin/python2.7 /usr/local/bin/python2.7-config
I've tried running import yum
on all phytons and only the 2.6 does not give me an error, so I tried changing the links back to 2.6 (Validated with python -V
to check it goes back to version 2.6.6), and yum still returns the "cannot import name Errors" error.
Also, the PATH variable:
# echo $PATH
/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/git/bin:/root/bin
The python configured on /usr/bin/yum
is #!/usr/bin/python2.6
, I've tried changing it to /python
, and even /phyton2
and I still get the error.