-
由于 python 新版本后,pip安装包时会出现,ssl报错的问题
-
下载 安装 openssl
apt-get openssl apt-get libssl-dev
-
centos 版本
yum install openssl yum install openssl-devel -y
-
安装好后,进入安装包 /python3
-
找到 Modules/Setup ,vi 打开
vi /usr/local/src/python3/Modules/Setup
-
修改以下代码
# Socket module helper for socket(2) _socket socketmodule.c # Socket module helper for SSL support; you must comment out the other # socket line above, and possibly edit the SSL variable: #SSL=/usr/local/ssl _ssl _ssl.c \ -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ -L$(SSL)/lib -lssl -lcrypto
-
接着重新安装python
sudo .\configure --with-ssl sudo make && make install
-
随后查看操作是否成功
pip3 install requests
操作成功!!!
摘录来源 https://blog.csdn.net/xuanlv2017/article/details/78524562