“ssl module in Python is not available”

I use Linux distros and face the problem since the new installation of Python 3.6. I tried a couple of solution and finally solved the problem. The steps I followed are as below.

On Debian like distros

sudo apt-get install build-essential checkinstall libreadline-gplv2-dev ibncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

Change the directory to the Python3.6 location

cd /path/to/Python3.6/Module/

In the module directory, open the Setup file with your preferred text editor

vi Setup

Search for SSL and uncomment the related lines.

ssl _ssl.c \
    -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
    -L$(SSL)/lib -lssl -lcrypto

Save the file and on the root folder of your Python package, run the following command.

make
sudo make install

And finally, run the pip3 to install your required module(s).

Leave a Comment