ImportError: No module named yum

Jmnote bot (토론 | 기여)님의 2020년 12월 27일 (일) 13:30 판 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

1 개요[ | ]

ImportError: No module named yum
  • /usr/bin/yum, /usr/bin/yumdownloader 등에서 발생할 수 있음

2 문제상황[ | ]

[root@zetawiki ~]# yumdownloader openssh-server-5.3p1-94.el6.x86_64
Traceback (most recent call last):
  File "/usr/bin/yumdownloader", line 21, in <module>
    import yum
ImportError: No module named yum

3 확인[ | ]

[root@zetawiki ~]# cat /usr/bin/yumdownloader | head -1
#!/usr/bin/python
[root@zetawiki ~]# ll /usr/bin/python*
-rwxr-xr-x  1 root root 6252785 Jan 21  2015 /usr/bin/python
lrwxrwxrwx. 1 root root       6 May 26  2014 /usr/bin/python2 -> python
-rwx------  2 root root    9032 Jan 22  2014 /usr/bin/python2.6
-rwxr-xr-x  1 root root    1418 Jan 22  2014 /usr/bin/python2.6-config
lrwxrwxrwx  1 root root      16 Sep  4  2014 /usr/bin/python-config -> python2.6-config
-rwx------  2 root root    9032 Jan 22  2014 /usr/bin/python_old
[root@zetawiki ~]# /usr/bin/python -V
Python 2.7.9
[root@zetawiki ~]# /usr/bin/python2.6 -V
Python 2.6.6
[root@zetawiki ~]# /usr/bin/python -c 'import yum'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named yum
[root@zetawiki ~]# /usr/bin/python2.6 -c 'import yum'
[root@zetawiki ~]#
→ yum계열은 Python으로 작성되어 있음
→ Python을 2.7로 업그레이드 했는데 Python yum 모듈이 2.6 버전에만 있어서 발생하는 문제

4 yumdownloader 수정[ | ]

[root@zetawiki ~]# vi /usr/bin/yumdownloader
#!/usr/bin/python2.6
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

5 확인 2[ | ]

[root@zetawiki ~]# yumdownloader openssh-server
... (생략)
openssh-server-5.3p1-118.1.el6_8.x86_64.rpm                         | 328 kB     00:00

6 같이 보기[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}