阿里云ECS centos7 自带python2.7
1.安装依赖包
yum install xz gcc zlib zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make2.下载并安装python3.6.1
wget http://mirrors.sohu.com/python/3.6.1/Python-3.6.1.tar.xz
xz Python-3.6.1.tar.xz
tar -xvf Python-3.6.1.tar
cd Python-3.6.1##进入解压后的目录
./configure –prefix=/usr/python3.6
make
make install3.建立python3.6的软连接
cd /usr/bin #此文件就好比Windows的path
mv python python.bak#移除python2.7的连接
ln -s /usr/python3.6/bin/python3 /usr/bin/python3 #建立python3的连接
可输入python3看是否成功
至此还不算完,此时pip仍为python2.7的pip,需要重新建立python3.6.1的pip连接
cd /usr/bin
mv pip
ln -s /usr/python3.6/bin/pip3 /usr/bin/pip3
至此centos7+python3.6配置完毕