Centos7 Python3.x源码安装
第一步,安装开发工具集
yum -y groupinstall "Development tools"
第二步,安装相关依赖包:
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
第三步,下载Python源码包,解压:
wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
tar -xvJf Python-3.6.2.tar.xz
第五步,编译:
cd Python-3.6.2 && ./configure --enable-optimizations # 进行配置优化
make && make install
第七步,创建软连接:
ln -s /usr/local/bin/python3 /usr/bin/python3
ln -s /usr/local/bin/pip3 /usr/bin/pip3