1. 卸载现有Python版本
sudo yum remove python
2. 安装开发工具
sudo yum groupinstall "Development Tools" -y sudo yum install openssl-devel bzip2-devel libffi-devel -y
3. 下载Python源代码
curl -O https://www.python.org/ftp/python/3.11.4/Python-3.11.4.tg
4. 解压源代码
tar xzf Python-3.11.6.tgz
5. 配置安装选项
cd Python-3.11.6 ./configure --enable-optimizations
6. 编译和安装
make sudo make altinstall
7. 验证安装
python3.11 --version
8. 创建软链接(可选)
sudo ln -s /usr/local/bin/python3.11 /usr/bin/python3
9. 安装pip
sudo python3.11 -m ensurepip
10. 更新pip
sudo python3.11 -m pip install --upgrade pip
11. 安装常用库
sudo python3.11 -m pip install numpy pandas
标签:python3.11,centos,Python,3.11,sudo,pip,安装 From: https://www.cnblogs.com/blog-dyn/p/18518506