pip下載第三方包太慢的解決辦法

1、國內幾個鏡像站點,鏡像站點如下:

https://pypi.douban.com/simple/ 豆瓣
http://mirrors.aliyun.com/pypi/simple/ 阿里
http://pypi.hustunique.com/simple/ 華中理工大學
http://pypi.sdutlinux.org/simple/ 山東理工大學
http://pypi.mirrors.ustc.edu.cn/simple/ 中國科學技術大學
https://pypi.tuna.tsinghua.edu.cn/simple 清華

2、我們在安裝包的時候,可以臨時指定從國內站點下載安裝,例如:

臨時使用,添加"-i"或 "–index"參數

pip install pandas -i http://mirrors.aliyun.com/pypi/simple/ 

3、也可以配置成永久默認從國內站點下載,Windows下配置:

在user目錄中創建一個pip目錄,如:C:\Users\xx\pip,新建文件pip.ini。(xx爲window用戶)

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com

4、Linux環境設置默認的配置:

修改 ~/.pip/pip.conf (如果沒有.pip目錄,需要創建一個,.pip代表隱藏目錄)

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章