参考https://blog.csdn.net/qianglei6077/article/details/86698847
首先找到安装python的路径,vim修改该路径下的Modules/Setup.dist文件
将如下几行取消注释
# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:
SSL=/usr/local/ssl
_ssl _ssl.c /
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl /
在安装python的路径下重新编译安装
[root@xxx Python-3.6.5]./configure --prefix=/usr/local/python37
[root@xxx Python-3.6.5]make & make install
然后就可以导入了!