Ubuntu pip install切换为清华大学镜像源

pip国内的一些镜像

阿里云 http://mirrors.aliyun.com/pypi/simple/
  中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
  豆瓣(douban) http://pypi.douban.com/simple/
  清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
  中国科学技术大学 http://pypi.mirrors.ustc.edu.cn

永久修改:
linux:
修改 ~/.pip/pip.conf :

sudo vim ~/.pip/pip.conf

修改为以下内容:

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

有时候即便添加了国内镜像源,下载速度可能也会比较慢,这时为了防止因网络太慢导致安装失败,则需要安装时设置默认超时时间:

pip install  tensorflow --default-timeout=6000
发布了88 篇原创文章 · 获赞 14 · 访问量 9666

猜你喜欢

转载自blog.csdn.net/sunmingyang1987/article/details/103383444