python3 설치 여부 확인
$ yum search python3
설치할 만만하게 없다면 ius를 추가한다.
$ yum install -y https://centos7.iuscommunity.org/ius-release.rpm
Loaded plugins: fastestmirror
Cannot open: https://centos7.iuscommunity.org/ius-release.rpm. Skipping.
Error: Nothing to do
이럴 때는 rpm을 다운로드하고 바로 설치한다.
$ wget https://centos7.iuscommunity.org/ius-release.rpm --no-check-certificate
$ yum install -y ius-release.rpm
$ sudo yum install -y python36u python36u-libs python36u-devel python36u-pip
$ python3.6 -V
Python 3.6.4
python3로 실행될 수 있도록 링크를 변경한다.
$ ls -l /bin/python*
lrwxrwxrwx. 1 root root 7 7월 3 2018 /bin/python -> python2
lrwxrwxrwx. 1 root root 14 7월 3 2018 /bin/python-config -> python2-config
lrwxrwxrwx. 1 root root 9 7월 3 2018 /bin/python2 -> python2.7
lrwxrwxrwx. 1 root root 16 7월 3 2018 /bin/python2-config -> python2.7-config
-rwxr-xr-x. 1 root root 7216 4월 11 2018 /bin/python2.7
-rwxr-xr-x. 1 root root 1835 4월 11 2018 /bin/python2.7-config
-rwxr-xr-x 2 root root 11384 5월 3 05:43 /bin/python3.6
lrwxrwxrwx 1 root root 26 7월 23 18:46 /bin/python3.6-config -> /usr/bin/python3.6m-config
-rwxr-xr-x 2 root root 11384 5월 3 05:43 /bin/python3.6m
-rwxr-xr-x 1 root root 173 5월 3 05:42 /bin/python3.6m-config
-rwxr-xr-x 1 root root 3435 5월 3 05:40 /bin/python3.6m-x86_64-config
$ sudo unlink /bin/python
$ sudo ln -s /bin/python3.6 /bin/python3
$ sudo ln -s /bin/python3.6 /bin/python
$ sudo ln -s /bin/pip3.6 /bin/pip
$ ls -l /bin/python*
lrwxrwxrwx 1 root root 14 7월 23 18:47 /bin/python -> /bin/python3.6
lrwxrwxrwx. 1 root root 14 7월 3 2018 /bin/python-config -> python2-config
lrwxrwxrwx. 1 root root 9 7월 3 2018 /bin/python2 -> python2.7
lrwxrwxrwx. 1 root root 16 7월 3 2018 /bin/python2-config -> python2.7-config
-rwxr-xr-x. 1 root root 7216 4월 11 2018 /bin/python2.7
-rwxr-xr-x. 1 root root 1835 4월 11 2018 /bin/python2.7-config
lrwxrwxrwx 1 root root 14 7월 23 18:47 /bin/python3 -> /bin/python3.6
-rwxr-xr-x 2 root root 11384 5월 3 05:43 /bin/python3.6
lrwxrwxrwx 1 root root 26 7월 23 18:46 /bin/python3.6-config -> /usr/bin/python3.6m-config
-rwxr-xr-x 2 root root 11384 5월 3 05:43 /bin/python3.6m
-rwxr-xr-x 1 root root 173 5월 3 05:42 /bin/python3.6m-config
-rwxr-xr-x 1 root root 3435 5월 3 05:40 /bin/python3.6m-x86_64-config
pip3를 설치한다.
$ wget https://bootstrap.pypa.io/get-pip.py
$ sudo -E python get-pip.py
$pip3 -V
pip 19.2 from /usr/lib/python3.6/site-packages/pip (python 3.6)