conda的配置文件.condarc 是可选的runtime配置文件,可以让高级用户配置conda的行为,比如包搜索的channel,代理的设置,环境目录等。

.condarc 默认是不存在的,当第一次是你用conda config 命令时,它会在用户的主目录创建。

添加conda-forge通道

conda config --add channels conda-forge

当需要对配置选项修改时,可以直接修改.condarc 文件,或者是使用conda config --set 命令。

例如,设置auto_update_conda 选项为False

conda config --set auto_update_conda False

查看conda config命令帮助

conda config --help

channels

.condarc 中,default 会自动包含所有的默认channels,而非URL的channel会解析为Anaconda.org

channels:
  - <anaconda_dot_org_username>
  - http://some.custom/channel
  - file:///some/local/directory
  - defaults

如果为某个环境选择channel,可以将.condarc 文件置于该环境的根目录

~/miniconda3/envs/flowers/.condarc

allow_other_channels

系统级别的.condarc 会设定允许的channels组,从而让用户可以通过其他的channel安装package,因为allow_other_channel默认是True。如果将其设置为False,则只有在系统级别的.condarc 设置的channel才可以被允许使用

allow_other_channels: False

results matching ""

    No results matching ""