CentOS7 yum安装python3.6

环境

[root@node1 ~]# cat /etc/redhat-release 
CentOS Linux release 7.6.1810 (Core)

依赖epel源

配epel源_阿里

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

安装python3.6.8

yum install python36 -y

依赖:python36-libs

安装pip3

# 搜索pip3的安装包名称
yum  whatprovides pip3

# 安装pip3
yum install python36-pip -y

依赖:python36-setuptools

验证

[root@node1 ~]# python3 --version
Python 3.6.8

查看指向

[root@node1 ~]# ll /usr/bin/python
lrwxrwxrwx. 1 root root 7 5月  13 23:21 /usr/bin/python -> python2
[root@node1 ~]# 
[root@node1 ~]# ll /usr/bin/python2*
lrwxrwxrwx. 1 root root    9 5月  13 23:21 /usr/bin/python2 -> python2.7
-rwxr-xr-x. 1 root root 7216 10月 31 2018 /usr/bin/python2.7
[root@node1 ~]# 
[root@node1 ~]# ll /usr/bin/python3*
lrwxrwxrwx 1 root root     9 5月  20 17:48 /usr/bin/python3 -> python3.6
lrwxrwxrwx 1 root root    18 5月  20 17:48 /usr/bin/python36 -> /usr/bin/python3.6
-rwxr-xr-x 2 root root 11408 4月  26 05:05 /usr/bin/python3.6
-rwxr-xr-x 2 root root 11408 4月  26 05:05 /usr/bin/python3.6m
[root@node1 ~]# 

由上可知
python 代表CentOS7系统默认的 python2.7
python3 代表新安装的 python3.6

安装python开发工具

yum install python36-devel -y