I\'ve install Python 3.4 and Python 3.6 on my local machine successfully, but am unable to install packages with pip3
.
When I execute pip3 install
The ssl
module is a TLS/SSL wrapper for accessing Operation Sytem (OS) socket (Lib/ssl.py). So when ssl
module is not available, chances are that you either don't have OS OpenSSL libraries installed, or those libraries were not found when you install Python. Let assume it is a later case (aka: you already have OpenSSL installed, but they are not correctly linked when installing Python).
I will also assume you are installing from source. If you are installing from binary (ie: Window .exe file), or package (Mac .dmg, or Ubuntu apt), there is not much you can do with the installing process.
During the step of configuring your python installation, you need to specify where the OS OpenSSL will be used for linking:
# python 3.8 beta
./configure --with-openssl="your_OpenSSL root"
So where will you find your installed OpenSSL directory?
# ubuntu
locate ssl.h | grep '/openssl/ssl.h'
/home/user/.linuxbrew/Cellar/openssl/1.0.2r/include/openssl/ssl.h
/home/user/envs/py37/include/openssl/ssl.h
/home/user/miniconda3/envs/py38b3/include/openssl/ssl.h
/home/user/miniconda3/include/openssl/ssl.h
/home/user/miniconda3/pkgs/openssl-1.0.2s-h7b6447c_0/include/openssl/ssl.h
/home/user/miniconda3/pkgs/openssl-1.1.1b-h7b6447c_1/include/openssl/ssl.h
/home/user/miniconda3/pkgs/openssl-1.1.1c-h7b6447c_1/include/openssl/ssl.h
/usr/include/openssl/ssl.h
Your system may be different than mine, but as you see here I have many different installed openssl libraries. As the time of this writing, python 3.8 expects openssl 1.0.2 or 1.1:
Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().
So you would need to verify which of those installed libraries that you can use for linking, for example
/usr/bin/openssl version
OpenSSL 1.0.2g 1 Mar 2016
./configure --with-openssl="/usr"
make && make install
You may need to try a few, or install a new, to find the library that would work for your Python and your OS.