Linux:CentOS6.10源码安装Python3.7
1、首先下载python3.7.5源码
wget "https://www.python.org/ftp/python/3.7.5/Python-3.7.5.tgz"
2、解压源码
tar xzvf Python-3.7.5.tgz
3、安装依赖库,不然python会报错找不到 _ctype等模块
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel gcc kernel-devel kernel-headers make bzip2
4、切换至源码目录并编译
cd Python-3.7.5
./configure --prefix=/usr/local/python3.7 --enable-optimizations
make && make install
5、软链接python3和pip3
ln -s /usr/local/python3.7 /usr/bin/python3
ln -s /usr/local/pip3.7 /usr/bin/pip3
6、Enjoy!!!