0

I am installing python 3.6.9 from source. I followed below this link to install python. But i am facing issue when i try to import ssl library. The error i am getting is ModuleNotFoundError: No module named '_ssl'. I followed this link to install openssl from source but still i am getting same error. I don't know what am i missing. I recompiled python after openssl installation but still getting the same error. I cannot use yum as my linux environment doesnt support internet.

Update: Steps i have done are below mentioned.

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
Ironman
  • 1,330
  • 2
  • 19
  • 40
  • 1
    The above mentioned links i have also tried but i am getting the same issue. – Ironman Oct 09 '19 at 17:45
  • Please include in the question the exact steps you took to build Python then. – blhsing Oct 09 '19 at 17:47
  • @blhsing please check – Ironman Oct 09 '19 at 17:55
  • I just followed the exact steps you posted, and was able to `import ssl` from the newly built Python interpreter. – blhsing Oct 09 '19 at 18:19
  • @blhsing which linux version are you using – Ironman Oct 10 '19 at 08:26
  • Ubuntu 16.04 with kernel 4.4.0-79-generic. – blhsing Oct 10 '19 at 13:33
  • 1
    By the way, it's probably worth pointing out that you've made a typo in the steps you posted. You downloaded Python 3.6.3 and yet you installed Python 3.6.9. So actually I did not follow your exact steps but rather installed both 3.6.3 and 3.6.9 and verified that the `ssl` module worked on both installations. – blhsing Oct 10 '19 at 13:36

0 Answers0