環境:系統是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了。。。