安装说明

CentOS7系统自带的Python版本是Python2.7,如需使用Python3.6,需要自行安装Python3.6。

CentOS7安装Python3.6有两种方式:

  • 使用Yum源安装Python3.6
  • 使用Python3.6源文件安装

本文推荐使用centos 7 Yum源安装。

安装步骤

IUS软件源中包含了Python3.6,可以使用IUS软件源安装Python3.6。

安装IUS软件源

#安装EPEL依赖
sudo yum install epel-release

#安装IUS软件源
sudo yum install -y https://centos7.iuscommunity.org/ius-release.rpm

如果上述IUS源无法安装或无响应,可使用下面的源

rpm -Uvh https://mirrors.tuna.tsinghua.edu.cn/ius/ius-release-el7.rpm

安装Python3.6

sudo yum install python36u

在安装完成后,可以查看是否存在python3 ,如果不存在可以创建相应软链接

sudo ln -s /usr/bin/python3.6 /usr/bin/python3

安装pip3

安装完成python36u并没有安装pip,如果需要安装python3的模块,则需要安装pip

sudo yum install python36u-pip

通过,如果pip3 命令不存在,则需要创建相应软链接

sudo ln -s /usr/bin/pip3.6 /usr/bin/pip3
最后修改:2020 年 08 月 15 日 04 : 33 PM