yum install -y libffi-devel
cd /usr/local/src
wget https://www.python.org/ftp/python/3.9.5/Python-3.9.5.tgz
tar zxvf Python-3.9.5.tgz
cd Python-3.9.5/
./configure --prefix=/usr/local/python3.9 --with-ssl
make && make install
ln -fs /usr/local/python3.9/bin/python3.9 /usr/bin/python
ln -fs /usr/local/python3.9/bin/python3.9 /usr/bin/python3
ln -fs /usr/local/python3.9/bin/pip3.9 /usr/bin/pip
ln -fs /usr/local/python3.9/bin/pip3.9 /usr/bin/pip3
vi /usr/bin/yum
vi /usr/libexec/urlgrabber-ext-down
第一行改都修改为: (原因是安装了python3.8,CentOS 7.X 自带的yum采用的是python2.X,当系统将python升级到2.7 或3.X后,出现语法解释错误)
#!/usr/bin/python2.7
python -m pip install --upgrade pip
出现错误必须:
ln -fs /usr/local/python3.9/bin/python3.9 /usr/bin/python
ln -fs /usr/local/python3.9/bin/python3.9 /usr/bin/python3
ln -fs /usr/local/python3.9/bin/pip3.9 /usr/bin/pip
ln -fs /usr/local/python3.9/bin/pip3.9 /usr/bin/pip3
必须
# 顺手解决 Can't locate Tcl/Tk libs and/or headers sudo yum install tcl-devel tk-devel # 解决_ssl问题 sudo yum install openssl-devel 网上的加什么网关方法都是不行的记住了,忙了半个小时