准备
openssl下载
python3下载
openssl安装目录:/usr/local/openssl
python安装目录:/usr/local/python
将下载的文件上传至上面目录
部署
openssl安装
cd /usr/local/openssl
tar -zxvf openssl-1.1.1w.tar.gz
cd openssl-1.1.1w
./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
make && make install
openssl version # 检查版本,版本如果是老版本继续执行下面的命令,如果是新版本跳过下面命令
ln -sf /usr/local/openssl/bin/openssl /usr/bin/openssl # 添加软链接
echo "/usr/local/openssl/lib" >> /etc/ld.so.conf.d/openssl.conf # 添加lib库
openssl version
python安装
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
cd /usr/local/python
tar -zxvf Python-3.11.5.tgz
cd Python-3.11.5
./configure --prefix=/usr/local/python --with-openssl=/usr/local/openssl # 指定openssl
make && make install
vi /etc/profile # 添加环境配置
source /etc/profile # 刷新环境配置
pip3 config set global.index-url https://mirrors.aliyun.com/pypi/simple/ # 添加pip国内镜像
pip3 config set install.trusted-host mirrors.aliyun.com