在这里首先强调一下,Centos7系统自带的Python2我们不要删除,我们要做的是在Python2和python3并存
1、安装依赖包
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc* make -y
2、下载python安装包
wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tar.xz
3、解压python安装包
tar -Jxvf Python-3.5.2.tar.xz
4、配置安装路径
切入到解压目录下
./configure prefix=/usr/local/python3
5、编译安装
切入到解压目录下
make && make install
6、配置软连接
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
7、导出之前python安装的包的清单
8、安装清单
Pip3 install -r package.txt