CentOS-6.9升级Python到3.5
下载Python-3.5
wgethttps://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz
解压
tarzxvfPython-3.5.0.tgz
进入Python-3.5.0目录
cdPython-3.5.0
指定安装位置
./configure--prefix=/usr/local/python3.5
编译安装
make&&makeinstall
下载并安装setuptools 18.5
wget--no-check-certificatehttps://bootstrap.pypa.io/ez_setup.py-O-|python
备份原有Python命令执行文件
mv/usr/bin/python/usr/bin/pythonbak
创建Python3.5软链接
ln-s/usr/local/python3.5/bin/python3.5/usr/bin/python
因为yum是不兼容 Python 3.5的,所以yum不能正常工作,需要指定 yum 的Python版本
vi/usr/bin/yum #!/usr/bin/pythonpython修改为#!/usr/bin/pythonpython2.6
结果
[root@backup~]#python--version Python3.5.0原文链接:https://www.f2er.com/centos/375737.html