The system does not have openssl, manually install openssl
1.Download openssl from http://www.openssl.org/source/openssl-1.0.2a.tar.gz
2.Install.
tar -xzvf openssl-1.0.2a.tar.gz
. /config --prefix=/usr/local --openssldir=/usr/local/openssl
make && make install
3. Find the include directory in the /usr/local directory
Find the path /usr/local/include, which will be used in the next steps
There are openssl files under this directory
[root@Linux local]# pwd
/usr/local
[root@Linux local]# ll
drwxr-xr-x. 2 root root 4096 11月 13 13:59 bin
drwxr-xr-x. 3 root root 4096 11月 13 13:59 include
drwxr-xr-x. 2 root root 4096 11月 1 2011 lib
drwxr-xr-x. 4 root root 4096 11月 13 13:59 lib64
drwxr-xr-x. 2 root root 4096 11月 1 2011 libexec
drwxr-xr-x. 2 root root 4096 11月 1 2011 sbin
4.In the python3.x source file, find the Setup.dist file and modify it as follows so that the openssl library you just installed can be found when you compile Python
1) Find the SSL related configuration
#SSL=/usr/local/ssl
#_ssl _ssl.c \
# -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
# -L$(SSL)/lib -lssl -lcrypto
2) (Since openssl is installed in the lib64 and include directories in the /usr/local directory, not in the /usr/local/ssl directory,) remove the comments and modify the path as follows
SSL=/usr/local
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib64 -lssl -lcrypto
5 To re-install and compile python 3.x
. /configure --prefix=/usr/local/xxxx
make && make install
6 Try to see if it is available
[root@iZbp1 Python-3.6.5]# python3
Python 3.6.5 (default, Mar 22 2019, 11:36:59)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>>
Similar Posts:
- PIP install Error: Could not fetch URL https: … ERROR: No matching distribution found for virtualenv
- Openeuler: How to Install OpenSSL
- Python Installation WARNING: pip is configured with locations that require TLS/SSL, however the ssl module…
- [Solved] Ruby cannot load such file — zlib, openssl(LoadError), gem No rule to make target `/include/ruby.h’
- PHP5.6.27 Install error: error: dereferencing pointer to incomplete type ‘EVP_PKEY’ {aka ‘struct evp_pkey_st’}
- Python Via get-pip.py Install pip Error: zipimport.ZipImportError: can‘t decompress data; zlib not availabl
- centos ModuleNotFoundError: No module named ‘_sqlite3’
- zlib.h:no such file or directory
- [How to Solve] gcc-4.7.2 cannot compute suffix of object fil…
- Mac: How to Solve M2Crypto Install error