網上搜到的pip國內鏡像大部分是豆瓣的http://pypi.douban.com/simple/
,但是根本不全,很多包沒有所以推薦清華大學的
https://pypi.tuna.tsinghua.edu.cn/simple
臨時修改方法
可以在使用pip的時候加參數-i https://pypi.tuna.tsinghua.edu.cn/simple
例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple ipykernel
,這樣就會從清華這邊的鏡像去安裝ipykernel包
永久修改方法
windows下,直接在user目錄中創建一個pip目錄,如:C:\Users\xx\pip,新建文件pip.ini,內容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
Linux下,修改 ~/.pip/pip.conf (沒有就創建一個), 修改 index-url至tuna,內容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple