一、安装python3.6可能使用相关软件
# yum
groupinstall ‘Development Tools‘
# yum
install -y ncurses-libs zlib-devel mysql-devel bzip2-devel
openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel
gdbm-devel db4-devel libpcap-devel xz-devel
二、安装python3.6.5
# cd
/usr/local
# wget
https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz
解压:
# tar -xf
Python-3.6.5.tar.xz
解压后新建文件夹将Python-3.6.5放在/usr/local/python3下
进入该目录
# cd Python-3.6.5
三、执行如下代码安装
--prefix选项是配置安装的路径,执行后所有资源文件放在/usr/local/python3.6的路径中
#
./configure --prefix=/usr/local/python3 --enable-optimizations
# make
# make
altinstall
四、修改软链接:
# ln -s
/usr/local/python3/bin/python3 /usr/bin/python3
# ln -s
/usr/local/python3/bin/pip3 /usr/bin/pip3
最后查看安装版本:
# python -V
# pip -V
原文地址:https://www.cnblogs.com/lone5wolf/p/10856008.html