python3.6.2 提示 ModuleNotFoundError: No module named '_ssl' 模块问题 ;
检测 系统 安装 OpenSSL
yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel gcc gcc-c++ openssl-devel
然后 重新编译 python
编辑 取消注释 以下几行:
cd python3.6.2/Modules/Setup.dist
大约在209 行
209SSL=/usr/local/ssl
210 _ssl _ssl.c \
211-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
212-L$(SSL)/lib -lssl -lcrypto
重新编译
./configure --prefix=/usr/local/python
或者是 cd python3.6.2
./configure
make
make install
python3.6.2
Python3.6.0(default, Nov302018,15:04:54)
[GCC 4.4.720120313(Red Hat4.4.7-16)] on linux
Type "help","copyright","credits"or"license"for more information.
>>> import ssl
>>>
Use quit() or Ctrl-D (i.e. EOF) to exit