centos python3.6升级到3.7
时间: 2023-11-07 20:49:56 浏览: 184
升级 Python 版本需要进行以下几个步骤:
1. 安装 Python 3.7
2. 安装 pip3.7
3. 将系统中使用的 python3 命令指向新安装的 Python 3.7 版本
下面是具体步骤:
1. 安装 Python 3.7
```shell
# 安装依赖
sudo yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel
# 下载 Python 3.7
wget https://www.python.org/ftp/python/3.7.12/Python-3.7.12.tgz
# 解压
tar xzf Python-3.7.12.tgz
# 进入目录
cd Python-3.7.12
# 配置
./configure --enable-optimizations
# 编译并安装
sudo make altinstall
```
2. 安装 pip3.7
```shell
# 下载 get-pip.py
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
# 使用 Python 3.7 安装 pip3.7
sudo python3.7 get-pip.py
```
3. 将系统中使用的 python3 命令指向新安装的 Python 3.7 版本
```shell
# 查看现有的 python3 软链接
ls -l /usr/bin/python3
# 修改软链接
sudo ln -sf /usr/local/bin/python3.7 /usr/bin/python3
# 验证 Python 版本是否已更新
python3 --version
```
这样就完成了 Python 3.6 升级到 Python 3.7 的过程。
阅读全文
相关推荐


















