티스토리 뷰
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.0
$ 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
File "/usr/bin/yum", line 30
except KeyboardInterrupt, e:
$ unlink /bin/python
$ ln -s /bin/python2 /bin/python
출처: http://depository.tistory.com/2 [depository]
'Python' 카테고리의 다른 글
python-nmap example (0) | 2017.03.28 |
---|---|
Python-nmap 설치 (0) | 2017.03.28 |
점프투파이썬 (0) | 2017.03.28 |