天天看點

pip安裝第三方庫報錯Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None))...

pip安裝第三方庫時報錯Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None))...,詳細報錯見下圖:

pip安裝第三方庫報錯Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None))...

報錯原因:

國外鏡像源連接配接問題導緻

解決:

改為國内鏡像源下載下傳

常用國内源:

清華:https://pypi.tuna.tsinghua.edu.cn/simple/

阿裡雲:http://mirrors.aliyun.com/pypi/simple/

中國科技大學 https://pypi.mirrors.ustc.edu.cn/simple/

華中理工大學:http://pypi.hustunique.com/

山東理工大學:http://pypi.sdutlinux.org/

豆瓣:http://pypi.douban.com/simple/

以清華大學鏡像源下載下傳為例:

一、直接使用鏡像源下載下傳

安裝指令:pip install xxx(包名) -i https://pypi.tuna.tsinghua.edu.cn/simple/ --trusted-host pypi.tuna.tsinghua.edu.cn

-i :後為鏡像源位址

--trusted-host :後邊指的是host,例清華大學鏡像源位址為 https://pypi.tuna.tsinghua.edu.cn/simple/,host就是指http://和/之間的部分,即pypi.tuna.tsinghua.edu.cn

pip安裝第三方庫報錯Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None))...

備注:其他鏡像源下載下傳,-i,--trusted-host後部分更新為使用的鏡像源即可,例,改為豆瓣鏡像源下載下傳,

   指令為:pip install xxx(包名) -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

二、配置預設使用某鏡像源下載下傳

1,在路徑C:\Users\xxx建立pip目錄,在該目錄下建立pip.ini檔案,将下面内容複制到pip.ini檔案中,并儲存

[global]

index-url = https://pypi.tuna.tsinghua.edu.cn/simple

[install]

trusted-host=pypi.tuna.tsinghua.edu.cn

pip安裝第三方庫報錯Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None))...

2,直接pip安裝第三方包

指令:pip install xxx(包名)

pip安裝第三方庫報錯Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None))...