安装依赖
[root@etl ~]# yum -y install zlib-devel bzip2-devel openssl-devel openssl-static ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel libffi-devel lzma gcc
安装包准备
[root@etl ~]# cd /usr/local/src/
#上传安装包
[root@etl src]# rz
#或者直接下载,速度超慢
[root@etl src]# wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
解压并移动
[root@etl src]# tar xvf Python-3.7.0.tar.xz
[root@etl src]# mv Python-3.7.0 /usr/local/python-3.7
[root@etl src]# cd /usr/local/python-3.7
安装
[root@etl python-3.7]# ./configure --prefix=/usr/local/sbin/python-3.7
[root@etl python-3.7]# make && make install
创建软连接
[root@etl python-3.7]# ln -s /usr/local/sbin/python-3.7/bin/python3 /usr/bin/python3
[root@etl python-3.7]# ln -s /usr/local/sbin/python-3.7/bin/pip3 /usr/bin/pip3
更新pip
[root@etl python-3.7]# pip3 install --upgrade pip