No module named yum

1 개요[ | ]

No module named yum 고치기
yum 오류 고치기
  • Python 또는 yum을 업그레이드 한 경우
  • Python 버전이 맞지 않아 yum 모듈 버전이 맞지 않는 경우
  • yum이 제대로 작동하지 않는다…[1]
[root@zetawiki ~]# 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:
2.7.9 (default, Jan 21 2015, 20:29:09) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)]

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

다음과 같이 /usr/bin/yum 파일을 수정하자.

기존 버전이 2.4이였다면 #!/usr/bin/python#!/usr/bin/python2.4
기존 버전이 2.6이였다면 #!/usr/bin/python#!/usr/bin/python2.6
[root@zetawiki ~]# cp /usr/bin/yum /usr/bin/yum_old
[root@zetawiki ~]# sed -i 's/\/usr\/bin\/python/\/usr\/bin\/python2.6/g' /usr/bin/yum
[root@zetawiki ~]# diff /usr/bin/yum_old /usr/bin/yum
1c1
< #!/usr/bin/python
---
> #!/usr/bin/python2.6
[root@zetawiki ~]# yum
... (생략)
    --sec-severity=SEVERITY
                        Include security relevant packages, of this severity
    --advisory=ADVISORY
                        Include packages needed to fix the given advisory
→ 이제 잘 된다.

2 같이 보기[ | ]

3 주석[ | ]

  1. /usr/bin/yum도 파이썬 스크립트임
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}