python3 pip換源

pip默認連接官網,下載包速度特別慢,還經常報異常:socket timeout,所以需要設置到國內鏡像服務器

一,單次運行時局部換源:

安裝一個模塊時在後面跟上 參數 -i + 源地址,比如

pip install pycryptodome -i https://mirrors.aliyun.com/pypi/simple/

二,本地全局換默認源:

比如:阿里鏡像(mirrors.aliyun.com),過程如下:

1、在C:\Users\[登錄賬戶]\AppData\Roaming目錄下創建文件夾:pip

2、在pip目錄創建文件pip.ini,輸入以下內容:

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

3、重新執行pip,默認的安裝源就是國內的了,跟ubuntu換源一個道理,速度很快
 

三,貼上幾個常用國內源:

清華大學:https://pypi.tuna.tsinghua.edu.cn/simple
阿里雲:http://mirrors.aliyun.com/pypi/simple/
豆瓣:http://pypi.douban.com/simple/

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章