1、臨時使用:
可以在使用pip的時候,加上參數-i和鏡像地址(如
https://pypi.tuna.tsinghua.edu.cn/simple),
例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pandas,這樣就會從清華鏡像安裝pandas庫。
2、永久使用:
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
3、防止網絡不好,下載一半因爲超時安裝失敗。
方法一:更改默認超時時間
pip
-
default
-
timeout
=
1000
-
U networkx
方法二:使用timeout參數增加時間
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple tensorflow --timeout 6000