国内常用镜像源地址【附配置方式pip and conda】

国内常用镜像源地址【附配置方式pip and conda】

Pip通用:

  • 清华大学:https://pypi.tuna.tsinghua.edu.cn/simple/
  • 阿里云:http://mirrors.aliyun.com/pypi/simple/
  • 中国科技大学:https://pypi.mirrors.ustc.edu.cn/simple/
  • 华中科技大学:http://pypi.hustunique.com/
  • 山东理工大学:http://pypi.sdutlinux.org/
  • 豆瓣:http://pypi.douban.com/simple/

Conda通用:

  1. 清华大学镜像:

    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
    https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/
    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
    
  2. 中科大镜像:

    https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
    https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
    https://mirrors.ustc.edu.cn/anaconda/cloud/
    https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
    
  3. 阿里云镜像:

    https://mirrors.aliyun.com/anaconda/pkgs/main/
    https://mirrors.aliyun.com/anaconda/pkgs/free/
    https://mirrors.aliyun.com/anaconda/cloud/
    https://mirrors.aliyun.com/anaconda/cloud/conda-forge/
    

使用方法:

PIP:

临时使用:

​ 1.单个包:pip install xxx -i <index_url>

​ 2.安装包文件列表: pip install -r requirements.txt -i <index_url>

​ 备注:<index_url>是你想要使用的镜像源的URL,第二个命令是指定镜像源下载requirements.txt中的所有插件。

永久更改pip的源:

​ 可以执行以下步骤:首先升级pip到最新的版本,然后进行配置。具体操作如下:

​ 1.升级pip:pip install pip -U

​ 2.输入:pip config list,查看现有镜像源

​ 3.设置pip源:pip config set global.index-url <index_url>

Conda:

临时使用:

​ 1.单个包:conda install --channel <index_url> xxx

​ 例子:conda install --channel https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/ pandas

​ 2.安装包文件列表【requirements.txt】:conda不支持

永久更改conda的源:

​ 可以按照以下步骤进行操作:

​ 1.输入conda config --show,查看当前conda的配置信息【channels项为镜像源】

​ 2.输入conda config --add channels <index_url>

​ 例子conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/

​ 3.输入conda config --update,更新配置文件,使更改生效

​ 4.再次运行conda config --show 命令,确认新的镜像源已经生效。

  • 4
    点赞
  • 51
    收藏
    觉得还不错? 一键收藏
  • 7
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值