如何使用conda constructor构建时配置conda-forge为默认通道?
Conda Constructor 设置默认通道为conda-forge的优化方案
方案1:用write_condarc自动生成配置文件
不用手动创建.condarc,直接在construct.yaml里添加以下配置,安装器会自动在目标环境生成对应的conda配置:
channels: - https://conda.anaconda.org/conda-forge conda_default_channels: - https://conda.anaconda.org/conda-forge # 自动生成.condarc内容 write_condarc: | channels: - conda-forge - defaults channel_priority: strict
要是不需要Anaconda的defaults通道,直接删掉- defaults那行即可。
方案2:升级Constructor版本
旧版本的Constructor可能存在conda_default_channels配置不生效的bug,先把Constructor更新到最新版再重新构建安装器:
conda install -n base conda-forge::constructor --update-deps
方案3:补充conda_channel_alias简化配置
如果自有包的仓库也是conda-forge格式的,添加这个配置可以简化通道写法,不用每次写完整URL:
conda_channel_alias: https://conda.anaconda.org/ channels: - conda-forge - your-custom-channel # 替换成你的自有包通道 conda_default_channels: - conda-forge
内容的提问来源于stack exchange,提问作者bht
相关产品推荐
相关产品推荐

