如何结合"conda create"?参数"--file",“-prefix"和"--copy"? [英] How to combine the "conda create" parameters "--file", "--prefix" and "--copy"?
问题描述
我想基于某个路径下的环境文件创建一个conda环境,不使用符号链接.因此,我想运行以下conda命令:
I would like to create a conda environment based on an environment file in a certain path, using no symlinks. Therefore, I would like to run the following conda command:
conda create --file environment.yml --prefix ./python --copy
文件 environment.yml
看起来像这样(我将其缩短了):
the file environment.yml
looks like this (I shortened it):
name: null
channels:
- defaults
dependencies:
- python==3.7.0
但是,出现以下错误:
CondaValueError: could not parse 'name: null' in: environment.yml
以下命令有效:
conda env create --file environment.yml --prefix ./python
但是,我不能使用-copy
参数:
However, then I cannot use the --copy
parameter:
error: unrecognized arguments: --copy
推荐答案
虽然我同意确实应该为此提供一个选项,但是您可以在运行时将 copy_always
配置选项临时设置为true该命令,并且应该可以解决问题:
While I agree that there really should be an option for this, you can temporarily set the copy_always
configuration option to true while you run the command and that should do the trick:
CONDA_COPY_ALWAYS=1 conda env create --file environment.yml --prefix ./python
为进行验证,我创建了带有和不带有 CONDA_COPY_ALWAYS = 1
的同一环境的两个版本.它们都单独在 du
中以969 MB的大小出现,但是当在 du
中包含 miniconda3/pkgs
时,只有那些没有 CONDA_COPY_ALWAYS = 1
的文件会减少. du
.
To verify, I created two versions of the same env with and without CONDA_COPY_ALWAYS=1
. They both come out as 969 MB in du
alone, but only the one without the CONDA_COPY_ALWAYS=1
gets reduced when including miniconda3/pkgs
in the du
.
这篇关于如何结合"conda create"?参数"--file",“-prefix"和"--copy"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!