CentOS 安装 Python3
网址
官网:
https://www.python.org/下载地址:
https://www.python.org/downloads/安装包安装
1 安装依赖包(切记安装)
yum -y groupinstall "Development tools"
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel xz-devel
2 下载Python3安装包
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz
3 解压
# 解压下载的安装包
tar -zxvf Python-3.7.2.tgz
4 配置&编译
进入解压目录
./configure
make && make install
5 安装 PIP
安装Python3时,会自动安装pip。假如没有,需要自己手动安装。
yum -y install python-pip
6 测试
# 运行 python3 进入 python 终端
python3