There are a lot of articles on the Internet about how to solve the failure of Python3.7 import _SSL module, but most of the actual operation is not successful. The following method can be used in a practical test.
First, install dependencies
OpenSSL or Libressl (either optional) is required to install the SSL module. OpenSSL is installed in version 1.0.1, which does not meet the requirements of Python3.7. The version requirements for the SSL library are as follows:
openssl > = 1.0.2 libressl & gt; = 2.6.4
My working environment:
14.04 Python3.7.3 Ubutun download link: https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
Download and install Libressl
Website: https://www.libressl.org/, download link: https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.9.1.tar.gz./config – prefix =/usr/local/SSL make sudo make intallmv/usr/bin/openssl/usr/bin/openssl. Bak (if not installed SSL before, /usr/include/openssl.bak /usr/include/openssl.bak This step can be skipped) ln -s/usr/local/SSL/bin/openssl/usr/bin/openssl ln -s/usr/local/SSL/include/openssl/usr/include/openssl in/etc/ld. So. Conf., d directory to create libressl – 2.9.1. Conf file, add/usr/local/SSL/libsudo ldconfig
Install Python3.7
Configure environment variables
Export LDFLAGS = “-l/usr/local/SSL/lib”
export CPPFLAGS = “-i/usr/local/SSL/include”
export PKG_CONFIG_PATH = “/ usr/local/SSL/lib/pkgconfig”
Unzip the Python installation package and execute the configure file:
./configure — enable – Shared
Check that the SSL configuration is working
Verifies that the SSL module was successfully installed in /usr/local/bin/python3.7
3. Other errors
Failed to compile the SSL module
Solutions:
Go to the libressl compilation directory libressl-2.9.1
Sudo cp SSL/libs/libssl. So the 47.0.5 – gnu/Linux/lib/x86_64 –
sudo cp crypto/libs/libcrypto. So the 45.0.4/lib/x86_64 – – the gnu/Linux
Sudo ln-s /lib/x86_64-linux-gnu/libcrypto.so.47.0.5 /lib/x86_64-linux-gnu/libcrypto.so.47
sudo ln-s /lib/x86_64-linux-gnu/libcrypto.so.45.0.4 /lib/x86_64-linux-gnu/libcrypto.so.45
recompile
Failed to compile the _ctypes module
Sudo apt-get install libffi-dev, install libffi-dev, install libffi-dev
First, install dependencies
OpenSSL or Libressl (either optional) is required to install the SSL module. OpenSSL is installed in version 1.0.1, which does not meet the requirements of Python3.7. The version requirements for the SSL library are as follows:
openssl > = 1.0.2 libressl & gt; = 2.6.4
My working environment:
14.04 Python3.7.3 Ubutun download link: https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tgz
Download and install Libressl
Website: https://www.libressl.org/, download link: https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.9.1.tar.gz./config – prefix =/usr/local/SSL make sudo make intallmv/usr/bin/openssl/usr/bin/openssl. Bak (if not installed SSL before, /usr/include/openssl.bak /usr/include/openssl.bak This step can be skipped) ln -s/usr/local/SSL/bin/openssl/usr/bin/openssl ln -s/usr/local/SSL/include/openssl/usr/include/openssl in/etc/ld. So. Conf., d directory to create libressl – 2.9.1. Conf file, add/usr/local/SSL/libsudo ldconfig
Install Python3.7
Configure environment variables
Export LDFLAGS = “-l/usr/local/SSL/lib”
export CPPFLAGS = “-i/usr/local/SSL/include”
export PKG_CONFIG_PATH = “/ usr/local/SSL/lib/pkgconfig”
Unzip the Python installation package and execute the configure file:
./configure — enable – Shared
Check that the SSL configuration is working
Verifies that the SSL module was successfully installed in /usr/local/bin/python3.7
3. Other errors
Failed to compile the SSL module
Solutions:
Go to the libressl compilation directory libressl-2.9.1
Sudo cp SSL/libs/libssl. So the 47.0.5 – gnu/Linux/lib/x86_64 –
sudo cp crypto/libs/libcrypto. So the 45.0.4/lib/x86_64 – – the gnu/Linux
Sudo ln-s /lib/x86_64-linux-gnu/libcrypto.so.47.0.5 /lib/x86_64-linux-gnu/libcrypto.so.47
sudo ln-s /lib/x86_64-linux-gnu/libcrypto.so.45.0.4 /lib/x86_64-linux-gnu/libcrypto.so.45
recompile
Failed to compile the _ctypes module
Sudo apt-get install libffi-dev, install libffi-dev, install libffi-dev
Read More:
- Solutions for failure to start Axure RP (including failure to uninstall or install. Net framework)
- Solutions to problems in SAS 9.3 x64 importing and exporting Excel
- SELinux solution to Apache SSL failure
- The solution to the error of importing CSV from Python to Python
- Solutions to the failure of R language loading rjava
- FreeRDP installation configuration (error message: SSL_read: Failure in SSL library (protocol error?))
- Solutions to the failure of installing jupyters in termux
- Solution to failure of SSL configuration in synergy
- Python error open SSL.SSL.SysCallError :(-1,‘Unexpected EOF‘)
- The most complete collection of solutions to Tortoise SVN Clean up failure
- Solutions to cookie output failure
- (20210301 solved) can’t connect to HTTPS URL because the SSL module is not available
- Importing the multiarray numpy extension module failed
- Android Failure [INSTALL_ FAILED_ VERSION_ Downgrad] solutions
- MQTT Host name verification failure (SSL) [How to Solve]
- Failure [INSTALL_ FAILED_ OLDER_ SDK] solutions
- LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443
- Python uses requests to request and reports SSL: CERTIFICATE_VERIFY_FAILED error
- After tensorflow installation, an error occurred while importing: importerror: DLL load failed: the specified module could not be found
- ImportError: Importing the multiarray numpy extension module failed.