欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

解決安裝python3.7.4報錯Can''t connect to HTTPS URL because the SSL module is not available

 更新時間:2019年07月31日 15:27:20   作者:whisshe  
這篇文章主要介紹了解決安裝python3.7.4報錯Can't connect to HTTPS URL because the SSL module is not available,本文給大家簡單分析了錯誤原因,給出了解決方法,需要的朋友可以參考下

簡述

從官網(wǎng)下載了Python3.7.4,直接編譯安裝后,使用pip3出現(xiàn)了報錯信息: Can't connect to HTTPS URL because the SSL module is not available

錯誤原因

在Python3.7之后的版本,依賴的openssl,必須要是1.1或者1.0.2之后的版本,或者安裝了2.6.4之后的libressl。


image.png

而本地的openssl依然是1.0.1e的。

[root@localhost ~]# openssl version
OpenSSL 1.0.1e-fips 11 Feb 2013

解決方法

上openssl官網(wǎng)下載1.0.2或者1.1之后的openssl包,編譯安裝。我選擇的是1.0.2r。

[root@localhost ~]# wget http://www.openssl.org/source/openssl-1.0.2r.tar.gz
[root@localhost ~]# tar zxvf openssl-1.0.2r.tar.gz
[root@localhost ~]# ./config --prefix=/opt/openssl1.0.2r --openssldir=/opt/openssl1.0.2r/openssl no-zlib
[root@localhost ~]# make && make install
[root@localhost ~]# echo "/opt/openssl1.0.2r/lib" >> /etc/ld.so.conf
[root@localhost ~]# ldconfig -v

注意:編譯openssl1.0.2r的時候建議加上no-zlib,否則后面可能會出現(xiàn)undefined symbol: SSL_CTX_get0_param錯誤

安裝python3.7

下載Python包,編譯

[root@localhost ~]# wget https://www.python.org/ftp/python/3.7.4/Python-3.7.4.tar.xz
[root@localhost ~]# tar xvf  Python-3.7.4.tar.xz
[root@localhost ~]# cd Python-3.7.4;./configure --prefix=/data/tools/Python3.7.4

編譯完成后不要make,先修改Python源碼包中ssl的參數(shù)

打開源碼解壓目錄中的 Modules/Setup ,直接搜索 SSL= ,將SSL=后面的目錄改為前面openssl的安裝目錄,并把下面三行的注釋去掉。

[root@localhost ~]# vim Modules/Setup
SSL=/opt/openssl1.0.2r
_ssl _ssl.c \
    -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
    -L$(SSL)/lib -lssl -lcrypto

改完之后就在解壓目錄直接make就行了。

[root@localhost ~]# make && make install
[root@localhost ~]# echo "export PATH=/data/tools/Python3.7.4/bin:$PATH" >> ~/.bashrc
[root@localhost ~]# source ~/.bashrc
[root@localhost ~]# pip3 list
Package  Version
---------- -------
pip    19.0.3 
setuptools 40.8.0 
You are using pip version 19.0.3, however version 19.2.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

總結(jié)

以上所述是小編給大家介紹的解決安裝python3.7.4報錯Can''t connect to HTTPS URL because the SSL module is not available,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!
如果你覺得本文對你有幫助,歡迎轉(zhuǎn)載,煩請注明出處,謝謝!

相關(guān)文章

最新評論