指定最低版本
Conda 足够强大,可以解析最小版本,并且它会记住它们已被指定。如果您希望 0.9 作为最小值,那么您只需这样说
conda install 'pandas-datareader>=0.9'
or
conda install pandas-datareader[version='>=0.9']
Once you've run this, it will be added into your explicit specifications,1 and that should lock in at least that version of pandas-datareader
, including in subsequent conda update --all
runs.2 This answer has a fuller description of Conda's MatchSpec system, which covers the scope of what can be specified.
通道规格
尽管这并不是 OP 真正想要的,但可能值得详细说明为什么会发生通道切换以及如何显式指定通道。
这--channel|-c
标志仅在与其一起使用的命令期间添加(并优先化)通道。它不会告诉 Conda 特定的包应该来自该渠道。因此,由于 OP 可能已经康达锻造公司优先于defaults在其全局/用户配置中(请参阅conda config --show channels
), 跑步conda update --all
将简单地切换回最近上传的版本。
要明确指示包应该来自通道,应该使用
conda install anaconda::pandas-datareader
然后这将添加anaconda::pandas-datareader
进入明确的规范,并且应该锁定这样一个事实:人们期望pandas-datareader
来从anaconda渠道。
封装固定
否则,封装固定可能是另一种选择。
[1] One can check explicit specifications with conda env export --from-history
.
[2] Be aware that some flags may override explicit specifications without warning, such as --update-deps
.