Centos 6
python3.6.0 提示 ModuleNotFoundError: No module named '_ssl' 模块问题 ;
检测 系统 安装 OpenSSL
国内 163 yum 源挺好用 (中科大的也不错) http://mirrors.163.com/.help/CentOS6-Base-163.repo yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel gcc gcc-c++ openssl-devel
然后 重新编译 python
编辑 取消注释 以下几行: ~ python/Modules/Setup.dist 大约在 209 行 209 SSL=/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
make
make install
python3.6.0
Python 3.6.0 (default, Nov 30 2018, 15:04:54) [GCC 4.4.7 20120313 (Red Hat 4.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
import ssl 没有提示,验证正常。