"ImportError: No module named yum"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-</source> +</syntaxhighlight>, -<source +<syntaxhighlight ))
 
4번째 줄: 4번째 줄:


==문제상황==
==문제상황==
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# yumdownloader openssh-server-5.3p1-94.el6.x86_64
[root@zetawiki ~]# yumdownloader openssh-server-5.3p1-94.el6.x86_64
Traceback (most recent call last):
Traceback (most recent call last):
10번째 줄: 10번째 줄:
     import yum
     import yum
ImportError: No module named yum
ImportError: No module named yum
</source>
</syntaxhighlight>


==확인==
==확인==
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# cat /usr/bin/yumdownloader | head -1
[root@zetawiki ~]# cat /usr/bin/yumdownloader | head -1
#!/usr/bin/python
#!/usr/bin/python
33번째 줄: 33번째 줄:
[root@zetawiki ~]# /usr/bin/python2.6 -c 'import yum'
[root@zetawiki ~]# /usr/bin/python2.6 -c 'import yum'
[root@zetawiki ~]#  
[root@zetawiki ~]#  
</source>
</syntaxhighlight>
:→ yum계열은 Python으로 작성되어 있음
:→ yum계열은 Python으로 작성되어 있음
:→ Python을 2.7로 업그레이드 했는데 Python yum 모듈이 2.6 버전에만 있어서 발생하는 문제
:→ Python을 2.7로 업그레이드 했는데 Python yum 모듈이 2.6 버전에만 있어서 발생하는 문제


==yumdownloader 수정==
==yumdownloader 수정==
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# vi /usr/bin/yumdownloader
[root@zetawiki ~]# vi /usr/bin/yumdownloader
</source>
</syntaxhighlight>
<source lang='python' highlight='1'>
<syntaxhighlight lang='python' highlight='1'>
#!/usr/bin/python2.6
#!/usr/bin/python2.6
# This program is free software; you can redistribute it and/or modify
# 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
# it under the terms of the GNU General Public License as published by
</source>
</syntaxhighlight>


==확인 2==
==확인 2==
<source lang='console'>
<syntaxhighlight lang='console'>
[root@zetawiki ~]# yumdownloader openssh-server
[root@zetawiki ~]# yumdownloader openssh-server
... (생략)
... (생략)
openssh-server-5.3p1-118.1.el6_8.x86_64.rpm                        | 328 kB    00:00   
openssh-server-5.3p1-118.1.el6_8.x86_64.rpm                        | 328 kB    00:00   
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==

2020년 12월 27일 (일) 13:30 기준 최신판

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 }}