Python pip install之SSL異常處理操作
異常內(nèi)容:
C:\Users\ccwant>pip install requests
Collecting requests
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)'),)': /simple/requests/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)'),)': /simple/requests/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)'),)': /simple/requests/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)'),)': /simple/requests/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)'),)': /simple/requests/
Could not fetch URL https://pypi.org/simple/requests/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/requests/ (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:645)'),)) - skipping
Could not find a version that satisfies the requirement requests (from versions: )
No matching distribution found for requests
處理辦法:
打開以下目錄,并創(chuàng)建pip文件夾
C:\Users\用戶\AppData\Roaming
進(jìn)入pip文件夾,創(chuàng)建pip.ini文件,內(nèi)容如下
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com
此配置的作用是修改pip的安裝源,此處修改為阿里的源,然后使用pip install安裝就不會報(bào)錯(cuò)了
補(bǔ)充知識:處理Python3中使用pip install時(shí)提示"SSL: CERTIFICATE_VERIFY_FAILED"
CentOS7使用官方y(tǒng)um源安裝了Python3和pip(yum搜不到python3的話請安裝epel-release)
[root@client0 yum.repos.d]# python3 --version
Python 3.6.8
[root@client0 yum.repos.d]# pip3 --version
pip 8.1.2 from /usr/lib/python3.6/site-packages (python 3.6)
使用pip安裝包時(shí)會提示你pip版本過低, 建議使用pip install --upgrade pip命令來升級.
而使用該命令時(shí)則會彈出一連串錯(cuò)誤提示, 其中包含關(guān)鍵字"SSL: CERTIFICATE_VERIFY_FAILED"
這時(shí)的處理辦法是跳過pip的SSL驗(yàn)證
使用命令
pip3 install --trusted-host pypi.org --trusted-host files.pythonhosted.org <package_name>
即可.
以上這篇Python pip install之SSL異常處理操作就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。
相關(guān)文章
Python編程matplotlib繪圖挑鉆石seaborn小提琴和箱線圖
這篇文章主要為大家介紹了Python編程如何使用matplotlib繪圖來挑出完美的鉆石以及seaborn小提琴和箱線圖,有需要的朋友可以借鑒參考下,希望能夠優(yōu)速幫助2021-10-10Python 尋找局部最高點(diǎn)的實(shí)現(xiàn)
今天小編就為大家分享一篇Python 尋找局部最高點(diǎn)的實(shí)現(xiàn),具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2019-12-12python使用ctypes調(diào)用第三方庫時(shí)出現(xiàn)undefined?symbol錯(cuò)誤詳解
python中時(shí)間的庫有time和datetime,pandas也有提供相應(yīng)的時(shí)間處理函數(shù),下面這篇文章主要給大家介紹了關(guān)于python使用ctypes調(diào)用第三方庫時(shí)出現(xiàn)undefined?symbol錯(cuò)誤的相關(guān)資料,需要的朋友可以參考下2023-02-02Python+Django在windows下的開發(fā)環(huán)境配置圖解
Python+Django在windows下的開發(fā)環(huán)境配置圖解教程,需要的朋友可以參考下。2009-11-11pandas 實(shí)現(xiàn)將重復(fù)表格去重,并重新轉(zhuǎn)換為表格的方法
下面小編就為大家分享一篇pandas 實(shí)現(xiàn)將重復(fù)表格去重,并重新轉(zhuǎn)換為表格的方法,具有很好的參考價(jià)值,希望對大家有所幫助。一起跟隨小編過來看看吧2018-04-04用virtualenv建立多個(gè)Python獨(dú)立虛擬開發(fā)環(huán)境
這篇文章主要為大家詳細(xì)介紹了用virtualenv建立多個(gè)Python獨(dú)立虛擬開發(fā)環(huán)境,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-07-07