IT/linux

[CentOS7] Python3.x 설치

주니- 2020. 8. 5. 10:08

업데이트 및 패키지 설치

yum -y update
sudo -y yum install yum-utils
sudo -y yum groupinstall development

 

IUM 저장소 설치

# CentOS 6
yum install \
https://repo.ius.io/ius-release-el6.rpm \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm

# CentOS 7
yum install \
https://repo.ius.io/ius-release-el7.rpm \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Python 설치

# 라이브러리 확인
yum search python3

# python3 설치
yum -y install python36u

# python 버전 확인
[root@centos7 home]# python --version
Python 2.7.5

[root@centos7 home]# python3 --version
Python 3.6.8

 

alias 등록

# 명령어 검색
[root@centos7 home]# which python3
/bin/python3

# ~/.bashrc 수정
vi ~/.bashrc

# 추가
alias python='/usr/bin/python3.6'

# :wq 및 적용
source ~/.bashrc