文章目录
- 1. 安装依赖项
- 2. 下载Python 3.10源码
- 3. 解压源码并进入目录
- 4. 配置安装选项
- 5. 编译并安装Python
- 6. 验证安装
- 7.创建软连接
- 8. 安装pip3
- 9. 换源
1. 安装依赖项
sudo yum groupinstall -y "Development Tools"
sudo yum install -y openssl-devel bzip2-devel libffi-devel
2. 下载Python 3.10源码
cd /usr/src
sudo wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz
3. 解压源码并进入目录
sudo tar xzf Python-3.10.0.tgz
cd Python-3.10.0
4. 配置安装选项
sudo ./configure --enable-optimizations
5. 编译并安装Python
sudo make altinstall
6. 验证安装
python3.10 --version
7.创建软连接
sudo ln -s /usr/local/bin/python3.10 /usr/local/bin/python3
sudo ln -s /usr/local/bin/python3.10 /usr/bin/python3
8. 安装pip3
sudo yum install python3-pip
9. 换源
参考这篇文章
https://blog.csdn.net/weixin_43721000/article/details/127508455