0x00 环境
Centos7.9,默认已安装python2.7.5
0x01 依赖软件
yum install wget zlib-devel bzip2-devel openssl-devel ncurses-devel readline-devel tk-devel gcc make zlib zlib-devel libffi-devel -y
0x02 下载Python
地址:python.org 右键复制链接
wget https://www.python.org/ftp/python/3.11.0/Python-3.11.0.tgz
tar -zxvf Python-3.11.0
cd Python-3.11.0
./configure --prefix=/usr/local/python3.11.0
make && make install
0x03 修改默认的python
centos7 默认已经安装了python2.7.5 ,输入python,会直接进入到2.7.5的版本下。因此为了使用方便,我们需要删除掉原来的python
rm -f /usr/bin/python
创建软连接,名字:python
ln -s /usr/local/python3.11.0/bin/python3.11 /usr/bin/python
0x04 修改yum
vi /usr/libexec/urlgrabber-ext-down #修改第一行的python为python2
#第二个修改的文件 yum程序本身
vi /usr/bin/yum
#修改第一行的python为python2即可
验证yum是否可用
完成!
标签:bin,python,3.11,devel,Centos7,yum,usr,安装,Python3 From: https://www.cnblogs.com/DevilCisco/p/16924063.html