簡體   English   中英

如何使用 conda-forge 而不是 anaconda 通道安裝“conda update --all”?

[英]How to get "conda update --all" to install using conda-forge instead of anaconda channel?

當我運行conda update --all時,默認情況下會更新來自 anaconda 頻道的包。 我寧願默認使用 conda-forge 頻道,因為這些軟件包是最新的。

我該怎么做呢?

要默認使用conda-forge通道, conda-forge應該具有比defaults通道更高的優先級。

檢查~/.condarc

cat ~/.condarc

它會返回這樣的東西

channels:
  - defaults
  - conda-forge
channel_priority: flexible

~/.condarc更改頻道順序,使 conda conda-forge forge 成為第一個頻道

channels:
 - conda-forge
 - defaults 
channel_priority: flexible

或者運行等效的命令行

conda config --add channels conda-forge
Warning: 'conda-forge' already in 'channels' list, moving to the top

下次運行conda update --all時,它將在defaults通道之前從conda-forge通道搜索。

Conda 文檔解釋了 conda 如何從不同的渠道收集包。

額外的

您應該考慮將channel_priority設置為strict ,當前flexible是默認設置。 根據 conda 文檔, strict將成為下一個主要版本 bump 的默認設置,即 conda 5.0。

conda config --set channel_priority strict

要了解 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

另請注意,這是一個全局設置。 參考這篇文章,如果這只應用於特定的 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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM