python3.7.2 ssl版本過低導致pip無法使用的問題


環境:系統是centos6.6,python:python3.7.2

問題:安裝好python3、pip后,在通過pip install xx 安裝模塊時,發現無法安裝的問題,提示版本太低,系統默認的是openssl1.0.1,需要1.0.2或者libressl。在網上也搜了各種資料,試了各種方式,終於給試出來了,現總結如下,希望幫到遇到此問題的同學。

錯誤提示:

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

Could not fetch URL https:*******: There was a problem confirming the ssl certificate: 
Can't connect to HTTPS URL because the SSL module is not available. - skipping

 

解決:

  安裝libressl代替openssl-devel 

   下載libress-2.8.3,wget https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-2.8.3.tar.gz

   解壓,安裝:

tar -zxvf libressl-2.8.3.tar.gz
cd libressl-2.8.3
./config –prefix=/usr/local/ssl 
make 
make intall

#原來的備份
mv /usr/bin/openssl /usr/bin/openssl.bak 
mv /usr/include/openssl /usr/include/openssl.bak 
#建立軟鏈
ln -s /usr/local/ssl/bin/openssl /usr/bin/openssl 
ln -s /usr/local/ssl/include/openssl /usr/include/openssl

cd /etc/ld.so.conf.d 
#新建文件 libressl-2.8.3.conf,增加以下內容
/usr/local/ssl/lib
ldconfig -v #重新加載庫文件

#驗證,如果出來LibreSSL 2.8.3,說明成功
openssl version 

 

然后再進行python3的安裝,這樣基本上就不會出現上面的問題了

注意:在編譯python的環境前,需要做以下環境變量配置:

  export LDFLAGS="-L/usr/local/ssl/lib" 
  export CPPFLAGS="-I/usr/local/ssl/include"
  export PKG_CONFIG_PATH="/usr/local/ssl/lib/pkgconfig"

接下來就可以好好地安裝python了。。。

    


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM