- 查看当前python版本
python --version
- 备份python
which python mv /usr/bin/python /usr/bin/python.bak
- 下载安装更新python3
wget https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz tar -xvJf Python-3.6.2.tar.xz
- 安装关联程序,安装编译python3
yum install -y zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make cd Python-3.6.2 ./configure prefix=/usr/local/python3 make && make install ln -s /usr/local/python3/bin/python3 /usr/bin/python
- 查看python版本
python --version
- 修改相关执行程序python版本
vi /usr/bin/yum 把#! /usr/bin/python修改为#! /usr/bin/python2 vi /usr/libexec/urlgrabber-ext-down 文件里面的#! /usr/bin/python 也要修改为#! /usr/bin/python2
原文地址:https://blog.51cto.com/9406836/2412785
时间: 2024-11-08 07:34:15