pip设置下载源为国内镜像

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

 

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