conda添加镜像源与channels

一、conda下添加国内镜像源(window下)

1、为【channels】配置清华镜像通道
直接在anaconda prompt.exe的命令行窗口或者cmd命令行(前提是配置了anaconda环境变量)下输入以下代码即可。

为【channels】源添加通道

channels源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/

custom_channels源添加
conda config --add custom_channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/

#设置搜索时显示通道地址
conda config --set show_channel_urls yes

2、设置搜索时显示通道地址

conda config --set show_channel_urls yes

3、显示【channels】源添加的所有通道

conda config --show channels

在这里插入图片描述

显示所有源的channels:

conda config --show-sources

在这里插入图片描述

4、删除【channels】源,换回默认源【default】

conda config --remove-key channels

二、pip配置国内镜像源(window下,临时修改)

1、配置pip镜像源
可以在使用pip的时候加参数-i https://pypi.tuna.tsinghua.edu.cn/simple/

pip install numpy -i 镜像源网址
pip install numpy -i https://mirrors.aliyun.com/pypi/simple/

国内常用源镜像地址,可自行替换。

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

三、conda源的定义

custom_channelsdefault_channelschannels都是.condarc文件中用于配置软件包源的选项,但它们之间有一些不同。

custom_channels是一个字典,其中包含了自定义软件包源的名称和URL。当你运行conda install等命令时,如果指定了自定义软件包源的名称,conda会使用custom_channels中列出的对应URL进行搜索。需要注意的是,如果你在命令行中指定了软件包源,conda会优先使用指定的软件包源,而不是custom_channels中列出的软件包源。

default_channels是一个列表,其中包含了conda搜索软件包时需要使用的默认软件包源。当你运行conda install等命令时,如果没有指定软件包源,conda会使用default_channels中列出的软件包源进行搜索。和custom_channels不同的是,default_channels中列出的软件包源是conda内置的、预定义的软件包源。

channels也是一个列表,其中包含了conda搜索软件包时需要使用的软件包源。和default_channels不同的是,channels列出的软件包源会覆盖default_channels中列出的软件包源。当你运行conda install等命令时,如果指定了软件包源,conda会使用channels中列出的软件包源进行搜索。

  • 5
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

看不见的罗辑

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值