1、下载源码包
cd /usr/local/src wget 'https://www.python.org/ftp/python/3.11.3/Python-3.11.3.tar.xz'
2、解压
xz -d Python-3.11.3.tar.xz tar zf Python-3.11.3.tar
3、安装编译工具和依赖包
yum -y install gcc-c++ openssl-devel
4、配置
mkdir -p /opt/python3
cd Python-3.11.3 ./configure --prefix=/opt/python3 --with-openssl=/usr/bin/openssl --with-ssl make make install
5、配置环境变量
vim /etc/profile.d/python.sh #添加以下配置 export PATH=$PATH:/opt/python3/bin #加载配置 source /etc/profile.d/python.sh
6、新增pip配置文件并更新pip
mkdir ~/.pip vim ~./pip/pip.conf #新增以下配置 [global] index-url = http://mirrors.aliyun.com/pypi/simple/ trusted-host = mirrors.aliyun.com #更新pip pip3 install --upgrade pip
7、安装模块
pip3 install xxxx
8、查看已安装模块
pip3 list
标签:python3.11,tar,Python,3.11,python,编译,pip,--,安装 From: https://www.cnblogs.com/NanZhiHan/p/17434807.html