I'm using conda to run tests against different versions of python, numpy, etc., but there are some common dependencies for all combinations of python/numpy. Is there a way to install such packages into all conda environments, or do I have to specify each by hand?
问问题
5171 次
3 回答
12
您可以对conda env list
. 例如:
for env in $(conda env list | cut -d" " -f1 | tail -n+4); do conda install -n $env XXXXXX; done
于 2018-08-12T16:06:57.933 回答
7
没有简单的命令可以做到这一点,但可能有帮助的一件事是使用conda metapackage
取决于您想要的包的命令制作元包,以便您可以安装它。类似的东西conda metapackage mypackage 1.0 --dependencies package1 package2 package3 ...
。
否则,您可能只需要巧妙地使用xargs
.
于 2014-06-11T21:31:35.880 回答
5
for
除了在@abalter 的答案中使用循环,您也可以使用 xargs 来完成。请注意,这仅适用于没有空格的环境名称:
conda env list | cut -d" " -f1 | tail -n+4 | xargs -L 1 conda install YOUR_PACKAGE -n
于 2019-11-14T09:52:33.890 回答