1.下载python安装包以及依赖的包
python安装包:Python-3.7.0
下载地址:www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
依赖安装包
zlib-devel krb5-devel ibselinux-devel
bzip2-devel openssl-devel ncurses-devel
sqlite-devel readline-devel tk-devel
gdbm-devel db4-devel libpcap-devel xz-devel
下载地址:http://rpmfind.net/linux/rpm2html/search.php?query=xz-devel&submit=Search+...&system=&arch=
2.上传这些安装包到任意目录下
3.解压python安装包
tar -xvJf Python-3.7.0.tar.xz
4.编译安装
mkdir /usr/local/python3 # 创建编译安装目录 cd Python-3.7.0 # 进入python的解压目录 ./configure --prefix=/usr/local/python3 make && make install # 编译$安装
5.创建软连接
ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3 ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3
6.验证是否安装成功
python3 -V
pip3 -V