最近在编译python3.7 遇到了找不到 SSL问题表现为:
python3
>> import ssl
>> 报错 找不到 ssl
或者 python3 允许一些脚本 报错 需要SSL支持
原因都是系统自动的OpenSSL库版本不符合 需要升级OpenSSL
升级方法 可以使用 llibressl 代替 https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/ 我下载的是 2.7.4 版本
正常 配置 安装即可 命令如下
./configure --prefix==/usr/local/lib(自定义路径,后面编译python要用到)
make && make install
接下来 编译python3 附带 openssl (这里需要特别注意,pyhon3.7 编译的参数)
python3.7 加 --with-openssl=DIR(上面安装的libressl库路径)
编译完成后就可以解决 python SSL 问题了。