python3报错No module named _ssl
2020-12-13 02:57
标签:profile 新版 配置 自带 了解 har mic Fix png 编译的时候能看到ssl成功加载 ssl模块成功导入 python3报错No module named _ssl 标签:profile 新版 配置 自带 了解 har mic Fix png 原文地址:https://blog.51cto.com/jinkcloud/2411644
在python使用过程中,发现报错No module named _ssl,但是系统已经安装opensll,于是开始了解决问题之旅
原因:
python3支持openssl版本最低为1.0.2,而系统比较老,自带的openssl版本为1.0.2
参考 https://www.jianshu.com/p/3ec24f563b81
安装新版openssl
https://www.openssl.org/source/mkdir /usr/local/openssl
tar xf openssl-1.1.1c.tar.gz
cd openssl-1.1.1c/
./config --prefix=/usr/local/openssl shared zlib
make && make install
echo ‘export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/openssl/lib‘ >> ~/.bash_profile
source ~/.bash_profile
安装python3
https://www.python.org/downloads/source/tar xf Python-3.7.3.tar.xz
mkdir /usr/local/python3
cd Python-3.7.3/
./configure prefix=/usr/local/python3 --with-openssl=/usr/local/openssl
make && make install
echo ‘
#配置python
export PYTHON_HOME=/usr/local/python3
export PATH=$PYTHON_HOME/bin:$PATH‘ >> ~/.bash_profile
source ~/.bash_profile
验证ssl模块
文章标题:python3报错No module named _ssl
文章链接:http://soscw.com/essay/26652.html