python SSL 錯誤


python 使用pip 安裝模塊是提示SSL錯誤

 

出現該問題的原因由於系統的openssl是1.0.1的版本,對於python3.7太老了,需要更新為openssl1.0.2或者libressl2.64(不含)以后的版本,所以這里從libressl官網下載libressl源碼,編譯生成庫文件代替系統的openssl1.0.1

下載libressl

安裝SSL:

./config --prefix=/usr/local/ssl

make && make install

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

安裝完成后確定openssl 版本

openssl version

 

安裝python

./configure --prefix=/usr/python   --with-ssl --enable-shared CFLAGS=-fPIC

make &&  make install

ln -s /usr/python/bin/python /usr/bin/python

ln -s /usr/python/bin/pip3 /usr/bin/pip3

 

確定ssl 模塊

成功加載則安裝成功

 


免責聲明!

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



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