No module named yum -- centos 7


#1

Hello All,

I have updated my server with yum update -y, after that yum is not working, i understand there is a problem with Python, but not sure how to fix this. Please help me in this issue.
error:

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:
2.7.10 (default, Jan 3 2017, 01:01:44)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]

If you cannot solve this problem yourself, please go to
the yum faq at:
http://yum.baseurl.org/wiki/Faq


#2

@itz_sashi

This is becoz of the default version of Python was set to a version not provided by Red Hat.

For resolving this issue remove the symlink to the unsupported version of Python, and redirecting to the support method resolves the issue

# rm -rf /usr/bin/python

# ln -s /usr/bin/python2.6 /usr/bin/python 

for checking the version run the below command

# /usr/bin/python