CentOS 7.X 升级 Python 3.9.5

1. 安装依赖关系
yum install -y libffi-devel 

2. 下载和安装python包


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

3. 修改软连接
    1. 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

    2. 5.修改yum文件

    3. vi /usr/bin/yum
      vi /usr/libexec/urlgrabber-ext-down 第一行改都修改为: (原因是安装了python3.8,CentOS 7.X 自带的yum采用的是python2.X,当系统将python升级到2.7 或3.X后,出现语法解释错误)

    4. #!/usr/bin/python2.7

    5. 6.升级pip

    6. 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

网上的加什么网关方法都是不行的记住了,忙了半个小时
上一篇:已解决:目标文件过大,无法复制到U盘


下一篇:为什么有些项目要用 Node.js超详细分析