1. 상태 

 파이썬을 2.7.5 ( Centos7 기본) 에서 2.7.14 로 업데이트 한 상태에서 python3.X 버전도 추가로 설치

설치 방법은 

https://zladnrms.tistory.com/19

 

 

[CentOS] Python 3.7 설치

기본적으로는 Python 2.7 이 설치되어있으므로, 그와 충돌을 피하기 위한 방법도 필요하다. 2.7 to 3.7 $ sudo yum install gcc openssl-devel  libffi-devel bzip2-devel $ wget https://www.python.org/ftp..

zladnrms.tistory.com

를 이용하여 마지막에

alternatives --install 를 이용한 버전 관리 처리를 추가로 진행

예)

alternatives --install /usr/bin/python python /usr/bin/python2 50

alternatives --install /usr/bin/python python /usr/bin/python3 60

 

여러 버전을 사용하기위한 설치로

설정 변경을 하려면 

alternatives --config python

으로 변경하여 사용한다.

 

까지는 좋았는데 yum 으로 설치 할 일이 생겨 설치 진행을 하니...


#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.14 (default, Mar 31 2020, 02:52:27)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]

If you cannot solve this problem yourself, please go to
the yum faq at: 

     yum.baseurl.org/wiki/Faq

 

----

위링크도 연결 되지 않는다.

 

여러 구글링하며 찾은 글을 봤더니 2.7 버전차이라고 생각하며 복구하는 여러 방법들이

돌아 다닌다.

1. 2.4 버전 변경 --> 이는 6.0 인듯합니다. 패스

2. /usr/bin/yum --> 파일열어 경로 첫줄에 경로 변경. 하지만 이미 버전이 업된 상태에서 처리가 쉽지 않고 기존

                          상태를 원상복구 하기가 어려워 졌다.  rpm 으로 재설치도 해봤다.

                          해보는것도 괜찮음

하지만, 

기본 상태로 원복은 한번 꼬이기 시작해서 인지 잘 되지 않음...

 

찾다가 다른 싸이트에 발견한 방법이 있음

 

 

# python
Python 2.7.14 (default, Mar 31 2020, 02:52:27)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>> import sys
>>> sys.path
....경로 A

이 경로와

# env -u LD_LIBRARY_PATH python

Python 2.7.5 (default, Nov  6 2016, 00:28:07) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>> import sys
>>> sys.path
....경로 B

A와 B의 상의 함에 있어 발생하는 문제로 반단이 된다고 함.

B 경로에  

'/usr/lib64/python2.7', '/usr/lib64/python2.7' ...

있다면 아래와 같이 설정을 변경해야 합니다. B 형태의 파이썬 실행 (밑줄)의 힌트로 보면

환경변수에 문제가 있음을 알수 있습니다.

 

alias yum='LD_LIBRARY_PATH=/usr/lib64 yum'

 

yum 실행을 환경변수의 구해 받기 않게 실행하게끔 하면 완료

 

개발과 환경 세팅은 참 언제나 신세계

그럼 즐프

+ Recent posts