Python ModuleNotFoundError:没有名为'_ssl';

Python ModuleNotFoundError:没有名为'_ssl';,python,linux,ssl,openssl,Python,Linux,Ssl,Openssl,我正在从源代码安装python 3.6.9。我按照下面的步骤安装python。但当我尝试导入ssl库时,我遇到了一个问题。 我收到的错误是modulenofounderror:没有名为“\u ssl”的模块。 我遵循这一点从源代码安装openssl,但仍然收到相同的错误。我不知道我错过了什么。我在openssl安装后重新编译了python,但仍然得到相同的错误。 我无法使用yum,因为我的linux环境不支持internet 更新: 我所做的步骤如下所述 1. wget http://www.

我正在从源代码安装python 3.6.9。我按照下面的步骤安装python。但当我尝试导入ssl库时,我遇到了一个问题。 我收到的错误是
modulenofounderror:没有名为“\u ssl”的模块
。
我遵循这一点从源代码安装openssl,但仍然收到相同的错误。我不知道我错过了什么。我在openssl安装后重新编译了python,但仍然得到相同的错误。
我无法使用yum,因为我的linux环境不支持internet

更新: 我所做的步骤如下所述

1.  wget http://www.openssl.org/source/openssl-1.0.2e.tar.gz
2. ./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl
3. $ make
   $ make test
   $ make install
4. wget https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tar.xz 
5. tar xJf Python-3.6.9.tar.xz
6. vim Modules/Setup.dist
   uncommented the ssl code
  _socket socketmodule.c

  # 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 \
    -L$(SSL)/lib -lssl -lcrypto
7. ./configure
   make
   make install

上面提到的链接我也尝试过,但我也遇到了同样的问题。请在问题中包括您当时构建Python所采取的确切步骤。@blhsing请检查我刚刚遵循了您发布的确切步骤,并且能够从新构建的Python解释器
导入ssl
。@blhsing您使用的是哪个linux版本