centos 安装python3.6
环境准备
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
首先去官网下载python3.6
https://www.python.org/ftp/python/
这里我们下载
yum -y install wget # 安装wget
wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz
创建python3.6目录
mkdir /usr/local/python3.6
解压python3.6安装包
tar -xzvf Python-3.6.8.tgz
进入解压路径
cd Python-3.6.8
源码安装三个步骤
# 配置(configure)
./configure --prefix=/usr/local/python3.6 --enable-optimizations # 编译(make)
make # 安装(make install)
makeinstall
建立软连接
make
makeinstall
ln -s /usr/local/python3/bin/python3.6 /usr/bin/python3.6 ln -s /usr/local/python3/bin/pip /usr/bin/pip3.6
加入环境变量
在etc/profile最后一行中加入变量 export PATH="$PATH:/usr/local/python3.6/bin"
检测是否安装成功
python3.6 # 进入python3.6 pip3.6 -V # 显示pip的版本