Coolx World - Computer ???
Python 업데이트 이후에 yum 실행이 안 될때. (Linux)
2016-05-31 16:14 - swindler
Python을 수동으로 설치하고 나면 /usr/bin/python 등의 경로가 다 바뀌기 때문에
yum이 실행이 안 되는 경우가 발생한다.

[root@xxx yyy]# yum update whatap-agent
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.6 (default, Feb 19 2016, 00:02:34)
[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



이 경우 구글링을 해보면 python을 제거하라는둥, 뭐 이런저런 해결책이 나오긴 한데,
그다지 깔끔하지가 않다.

아주 간단하게는 /usr/bin/yum 파일 자체를 수정하면 쉽게 해결된다.

기존에 python 2.6을 사용하다가 수동으로 2.7로 설치한 경우에

/usr/bin/yum 의 첫번째중에 있는 부분을 수정해야 한다.
#!/usr/bin/python

/usr/bin/python이 기존에 2.6 버전으로 symbolic link가 되어 있다가, 설치하면서 2.7로 바뀌었기 때문이다.

따라서 아래과 같이 기존 버전 경로로 직접 수정해 주면 된다.
#!/usr/bin/python2.6


Copyright © 1999-2020, swindler.

  2HLAB   2HLAB_Blog   RedToolBox   Omil   Omil_Blog