更换国内镜像源进行pip安装【附带国内镜像源】

Linux中当我们需要安装某个模块时(比如tensorflow2.0.0),常见有三种方法:
  1. pip install tensorflow==2.0.0
  2. pip install https://pypi.douban.com/simple tensorflow==2.0.0
  3. pip install -i https://pypi.douban.com/simple --trusted-host pypi.douban.com tensorflow==2.0.0

第一种是最为基础简单的使用国外源安装,很简洁方便。但下载相对国内源缓慢,中途容易退出或者丢包,所以安装大模块时使用较少。

第二种和第三种是我经常使用的,他们的区别就在于设置--trusted-host pypi.douban.com信任该镜像源。

当使用第二种安装遇到 ERROR: Cannot determine archive format of :XXXXXXXXXX 这种错误时,改为第三种即可。

 

国内其他镜像源:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn 模块名 //清华大学
pip install -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com/pypi 模块名       //阿里云
pip install -i http://pypi.douban.com/simple --trusted-host pypi.douban.com 模块名                       //豆瓣
pip install -i http://pypi.mirrors.ustc.edu.cn/simple --trusted-host pypi.mirrors.ustc.edu.cn 模块名     //中科大
pip install -i https://mirrors.163.com/pypi/simple --trusted-host mirrors.163.com/pypi 模块名           //网易云
posted @ 2022-05-09 17:32  歆布  阅读(88)  评论(0编辑  收藏  举报