In centos7 system, install the original way to install python3.6, when library use request, the system will prompt
报错信息: Can't connect to HTTPS URL because the SSL module is not available
problem analysis:
Viewing System openssl version:
Reinstall the python, coupled with the -with-ssl
./configure –prefix=/usr/local/Python3.71 –with-ssl
make&make install
I began to check:
Import module is not being given to ssl
Method Two:
1. compile and install OpenSSL 1.0.2j version and re-configuration environment variable
Download OpenSSL source package :( performed under / usr / local / python3)
wget http://www.openssl.org/source/openssl-1.0.2j.tar.gz
Decompress, compile and install:
tar -zxvf OpenSSL-1.0.2j.tar.gz
cd OpenSSL-1.0.2j
# Modify translation parameters, no-zlib not need zlib ./config --prefix = / usr / local / to python3 / OpenSSL-NO-zlib 1.0.2j
make && make install
2. Re-compile and install python3.6.2
tar -zxvf Python-3.6.2.tgz
cd Python-3.6.2
./configure --prefix=/usr/local/python3
After this step, do not worry run make. To modify the source directory Python-3.6.2 / Modules / Setup file:
[root@localhost ~]
# vim Modules/Setup
# Socket module helper for socket(2)
#_socket socketmodule.c
SSL Module Helper for the Socket # Support; the Comment you the MUST OUT at The OTHER
# socket Line above, and Possibly Edit variable at The SSL:
SSL = / usr / local / Lab / OpenSSL-1.0.2j / # uncomment this line, and the original / usr / local / ssl openssl directory changed our newly installed: /usr/local/python3/openssl-1.0.2j/
_ssl _ssl.c \ # uncomment this line
-DUSE_SSL -I $ (SSL) / include -I $ (SSL) / include / openssl \ # uncomment this line
-L $ (SSL) / lib -lssl -lcrypto # uncomment this line
Finally, re-compile and install python3:
make& make install
Again lead pack, successfully installed
Into the pit is completed.
Reference documents: http://www.yueguangzu.net/?p=1677
https://blog.csdn.net/reblue520/article/details/94072018
https://www.jb51.net/article/166688.htm