Linux笔记-Caused by SSLError(“Can‘t connect to HTTPS URL because the SSL module is not available.“)

x33g5p2x  于2022-08-17 转载在 Linux  
字(0.7k)|赞(0)|评价(0)|浏览(708)

这里是我用把Python用pyinstaller打包后,出现的问题。

解决是重安下OpenSSL。

wget http://www.openssl.org/source/openssl-1.0.2j.tar.gz
tar -zxvf openssl-1.0.2j.tar.gz
cd openssl-1.0.2j

./config --prefix=/usr/local/openssl shared zlib
make && make install

安装好后,再重按下Python3

./configure --prefix=/usr/local/python3 -enable-shared
cd Modules
vi Setup

修改如下内容:

...
# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:

SSL=/usr/local/openssl/
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto

设置好软连接:

ln -s /usr/local/openssl/lib/libssl.so.1.0.0 /usr/lib64/libssl.so.1.0.0
ln -s /usr/local/openssl/lib/libcrypto.so.1.0.0 /usr/lib64/libcrypto.so.1.0.0
cd ..
make && make install

最后重新打包就好了:

pyinstaller xxx.py

相关文章

微信公众号