# 下载源码包安装,先装wget,或curl。 yum install wget # 再安装解压缩和编译环境: yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel # 下载源码包: cd /usr/local/src wget https://www.python.org/ftp/python/3.6.0/Python-3.6.0.tgz # 解压: tar -zxf /usr/local/src/Python-3.6.0.tgz && cd Python-3.6.0 mkdir /usr/local/python3 # 编译安装: ./configure --prefix=/usr/local/python3 make && make altinstall # 建立链接 ln -s /usr/local/python3/bin/python3.6 /usr/bin/python3 # 可直接使用 "python3" ln -s /usr/local/python3/bin/pip3.6 /usr/bin/pip3
------------------我-是-分-割-线----------------------------------
把分割线以上的内容保存为install_python3.sh, 然后加上运行权限:
chmod a+x install_python3.sh
用root权限运行
./install_python3.sh
结束后就安装成功了。
# 可直接使用 "pip3"
# 最后测试下
python3
pip3