1、安装python3.6.5源及依赖包
# yum install epel-release –y # yum groupinstall "Development tools" –y # yum install zlib-devel bzip2-devel openssl-devel ncurses-devel zx-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel –y
2、编译安装python3.6.5
# wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz --no-check-certificate # tar xf Python-3.6.5.tar.xz # cd Python-3.6.5 # ./configure --prefix=/usr/local --with-ensurepip=install --enable-shared LDFLAGS="-Wl,-rpath /usr/local/lib" # make && make altinstall
3、使用python3.6.5
#进入python3.6.5使用命令
# python3.6
# 查看版本号 # python3.6 -V
# 有些系统不会自动添加环境变量,手动添加方法,编辑/etc/profile
# vi /etc/profile
# 在最后一行添加
export PATH=$PATH:/usr/local/bin
#保存退出
#修改后立即生效
# source /etc/profile