1 安装依赖
sudo yum - y updatesudo yum - y install openssl- devel bzip2- devel expat- devel gdbm- devel readline- devel sqlite- devel psmisc libffi- devel - ysudo yum - y groupinstall "Development Tools"
2 安装必需的 openssl >= 1.1.1
wget https: // www. openssl. org/ source/ openssl- 1.1 . 1q. tar. gz - - no- check- certificatetar zxf openssl- 1.1 . 1q. tar. gzcd openssl- 1.1 . 1q. / config - - prefix= / usr/ local/ openssl- 1.1 .1 sudo make & & sudo make install
3 安装python3.11.2
wget https: // www. python. org/ ftp/ python/ 3.11 .2 / Python- 3.11 .2 . tgztar - xf Python- 3.11 .2 . tgzcd Python- 3.11 .2
. / configure - - prefix= / usr/ local/ python311yum install openssl- devel bzip2- devel expat- devel gdbm- devel readline- devel sqlite- devel psmisc libffi- devel zlib* libffi- devel - ymake & & make install
cd / usr/ local/ python311/ bin
ln - s / usr/ local/ python311/ bin / python3 / usr/ bin / python3
ln - s / usr/ local/ python311/ bin / pip3 / usr/ bin / pip3
python 2 . x pip
python3 3.6 pip3
python3. 11 3.11 pip3. 11
rm - rf Python- 3.11 .2
rm - rf Python- 3.11 .2 . tgz
注意:使用pip3,报错
1 先安装EPEL
yum install https: // dl. fedoraproject. org/ pub/ epel/ epel- release- latest- 7 . noarch. rpm2 将原有的备份epel. repo和epel- testing. repo
mv / etc/ yum. repos. d/ epel. repo / etc/ yum. repos. d/ epel. repo. backmv / etc/ yum. repos. d/ epel- testing. repo / etc/ yum. repos. d/ epel- testing. repo. back3 重新安装epel. repo
sudo wget - O / etc/ yum. repos. d/ epel. repo http: // mirrors. aliyun. com/ repo/ epel- 7 . repo4 再运行如下命令,安装pip3
sudo yum install python3- pip