HOME > 이용안내
이용안내
 
작성일 : 18-11-02 09:25
[리눅스서버] [CentOS 7] Python 3을 Cent7에서 yum으로 인스톨 하는 방법
 글쓴이 : 제이네트워크
조회 : 35,803  

[CentOS 7] Python 3을 Cent7에서 yum으로 인스톨 하는 방법


1. IUS Community Project의 리포지토리를 yum의 리포지토리에 추가

$ yum install -y https://centos7.iuscommunity.org/ius-release.rpm


2. Python 3.6을 확인

$ yum search python36

$ yum search python35 ← Python 3.5를 확인


3. Python 3.6을 설치

$ yum install -y python36u python36u-libs python36u-devel python36u-pip

$ python3.6 -V   (설치 확인)

Python 3.6.x

$ which python3.6   (설치 장소 확인)

/usr/bin/python3.6


4. Alias 설정

현재 python 커맨드는 2.7로 설정 되어 있음

$ python -V

Python 2.7.5


현재 python 커맨드의 Alias를 확인하면 python → python2 → python2.7로 되어 있음

$ ls -l /bin/python*

lrwxrwxrwx  1 root root    12  2月 23 12:04 /bin/python -> /bin/python2

lrwxrwxrwx. 1 root root     9  2月  9 11:39 /bin/python2 -> python2.7

-rwxr-xr-x. 1 root root  7136 11月  6 09:29 /bin/python2.7

lrwxrwxrwx  1 root root    14  2月 23 11:58 /bin/python3 -> /bin/python3.6

-rwxr-xr-x  2 root root 11312  1月 20 08:03 /bin/python3.6

lrwxrwxrwx  1 root root    26  2月 23 11:56 /bin/python3.6-config -> /usr/bin/python3.6m-config

-rwxr-xr-x  2 root root 11312  1月 20 08:03 /bin/python3.6m

-rwxr-xr-x  1 root root   173  1月 20 08:02 /bin/python3.6m-config

-rwxr-xr-x  1 root root  3415  1月 20 07:59 /bin/python3.6m-x86_64-config


python → python3 → python3.6으로 설정

$ ln -s /bin/python3.6 /bin/python3

$ unlink /bin/python

$ ln -s /bin/python3 /bin/python


[pip도 설정]

$ ln -s /bin/pip3.6 /bin/pip


[설정 확인]

$ python -V

Python 3.6.0



[주의점!]

Alias를 python3.6으로 설정하면 yum 실행 시 아래와 같은 에러가 발생하므로 yum 사용 시에는 다시 되돌릴 필요가 있음.

혹은 python3 까지만 심볼릭 링크를 걸어서 사용할 것을 권장함.


$ yum   (명령어시 아래의 에러가 발생함 / yum명령어 사용시에는 링크변경해야함)

  File "/usr/bin/yum", line 30

   except KeyboardInterrupt, e:


$ unlink /bin/python

$ ln -s /bin/python2 /bin/python







Cloud server Streaming service Domain Cloud Firewall

 
 

Total 0

번호 제   목   글쓴이 날짜 조회
게시물이 없습니다.