[英]How to get "conda update --all" to install using conda-forge instead of anaconda channel?
When I run conda update --all
, packages from anaconda channel are updated by default.当我运行
conda update --all
时,默认情况下会更新来自 anaconda 频道的包。 I will prefer to have conda-forge channel by default because the packages are more up to date.我宁愿默认使用 conda-forge 频道,因为这些软件包是最新的。
How do I do this?我该怎么做呢?
To use conda-forge
channel by default, conda-forge
should have a higher priority than defaults
channel.要默认使用
conda-forge
通道, conda-forge
应该具有比defaults
通道更高的优先级。
Check the ~/.condarc
检查
~/.condarc
cat ~/.condarc
It will return something like this它会返回这样的东西
channels:
- defaults
- conda-forge
channel_priority: flexible
Change the channel order from ~/.condarc
so that conda-forge
is the first channel从
~/.condarc
更改频道顺序,使 conda conda-forge
forge 成为第一个频道
channels:
- conda-forge
- defaults
channel_priority: flexible
Or run the command line equivalent或者运行等效的命令行
conda config --add channels conda-forge
Warning: 'conda-forge' already in 'channels' list, moving to the top
Next time when you run conda update --all
, it will search from the conda-forge
channel before defaults
channel.下次运行
conda update --all
时,它将在defaults
通道之前从conda-forge
通道搜索。
Conda documentation explains how conda collect the packages from different channels. Conda 文档解释了 conda 如何从不同的渠道收集包。
Additional额外的
You should consider setting channel_priority
as strict
, currently flexible
is the default.您应该考虑将
channel_priority
设置为strict
,当前flexible
是默认设置。 Based on the conda documentation, strict
will be the default in the next major version bump, conda 5.0.根据 conda 文档,
strict
将成为下一个主要版本 bump 的默认设置,即 conda 5.0。
conda config --set channel_priority strict
To learn what channel_priority does, run conda config --describe channel_priority
要了解 channel_priority 的作用,请运行
conda config --describe channel_priority
channel_priority (ChannelPriority)
Accepts values of 'strict', 'flexible', and 'disabled'. The default
value is 'flexible'. With strict channel priority, packages in lower
priority channels are not considered if a package with the same name
appears in a higher priority channel. With flexible channel priority,
the solver may reach into lower priority channels to fulfill
dependencies, rather than raising an unsatisfiable error. With channel
priority disabled, package version takes precedence, and the
configured priority of channels is used only to break ties. In
previous versions of conda, this parameter was configured as either
True or False. True is now an alias to 'flexible'.
channel_priority: flexible
Also, note that this is a global setting.另请注意,这是一个全局设置。 Referring to this post , if this should only be applied to a specific conda environment, activate the env and add
--env
in your script参考这篇文章,如果这只应用于特定的 conda 环境,请激活 env 并在脚本中添加
--env
conda config --env --add channels conda-forge
conda config --env --set channel_priority strict
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.