CentOS-6.9升级Python到3.5
- 下载Python-3.5
wget https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz
- 解压
tar zxvf Python-3.5.0.tgz
- 进入Python-3.5.0目录
cd Python-3.5.0
- 指定安装位置
./configure --prefix=/usr/local/python3.5
- 编译安装
make && make install
- 下载并安装setuptools 18.5
wget --no-check-certificate https://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/python python修改为#!/usr/bin/python python2.6
- 结果
[[email protected] ~]# python --version Python 3.5.0
时间: 2024-11-05 16:00:14