[root@bhs Modules]# pwd
/root/Python-3.7.4/Modules
vi Setup.dist 文件没如下几行去掉其注释,并且重新编译安装python
_socket socketmodule.c
SSL=/usr/local/ssl
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
[root@bhs Python-3.7.4]# python3
Python 3.7.4 (default, Apr 27 2020, 23:47:44)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>>
成功解决问题