如何导出一个conda环境?(命令似乎无法正常工作)

huangapple go评论76阅读模式
英文:

How do I export a conda environment? (command seems not to be working)

问题

我想导出一个conda环境,以便在另一台电脑上使用。我找到了这个链接:https://docs.anaconda.com/anaconda-cloud/user-guide/tasks/work-with-environments/,然后使用其中的命令在通过Anaconda Navigator打开的命令提示符中执行,如下所示:conda env export --name root -f root.yml。但没有收到任何反馈,而root.yml文件似乎无处可找。

在查看stackoverflow后,我找到了命令conda env export > root.yml。然而,仍然没有反馈,并且root.yml文件也丢失了。仅运行conda env export 会显示环境的名称、通道、依赖项和前缀的列表。但仍然没有yml文件可以导出。

我有以下版本:

conda版本:4.7.12
conda-build版本:3.18.8
Python版本:3.7.3.final.0

有人能告诉我我做错了什么吗?

英文:

I would like to export a conda environment, so that I can use it on another PC. I found this:
https://docs.anaconda.com/anaconda-cloud/user-guide/tasks/work-with-environments/

And used the command that is in there, in the command promt opened via the anaconda navigator as follows: conda env export --name root -f root.yml. No feedback was given, and the root.yml file seems nowhere to be found.

After looking on stackoverflow, I found the command conda env export > root.yml. However, still no feedback is given, and the root.yml file is also missing. Running only conda env export gives a list of the name, channels, dependencies, and prefix. However, still no yml file to export.

I have the following versions:

 conda version : 4.7.12
    conda-build version : 3.18.8
         python version : 3.7.3.final.0

Can anyone tell me what I am doing wrong?

答案1

得分: 3

尝试使用以下命令:

conda list --name root --export > root-env.txt

这是保存环境规范的推荐方法之一。以conda可以重用的已知格式列出内容(使用--export标志),然后使用>运算符将其写入文件。

导出的文件将位于您运行命令的当前目录中。也就是说,运行:

C:\Users\hello>conda list --name root --export > root-env.txt

将文件保存到:

C:\Users\hello\root-env.txt
英文:

Try using this command:

conda list --name root --export > root-env.txt

This is one of the recommended methods for saving an environment spec. List the contents in a known format that conda can reuse (the --export flag) and then write to a file using the > operator.

The exported file will be in whatever directory you are running the command from. I.e. running:

C:\Users\hello>conda list --name root --export > root-env.txt

Will save the file to

C:\Users\hello\root-env.txt

答案2

得分: 0

尽管这是一个旧的问题和答案,但我最近也遇到了相同的问题。我在这里分享我的经验,以帮助其他人解决当前遇到这个问题的情况。

当使用以下命令时:

conda env export --from-history

(或者在conda env之后使用任何选项),我只会得到一个 [y/N]: 的输出,而没有其他响应。

我找到了两种解决这个问题的方法:

  • conda 必须安装在该环境中(从基本环境调用会导致空白的提示响应)
  • 将 conda 从 4.13.0 升级到 4.14.0(在该环境中运行 conda update conda
英文:

Although this is an old question & answer, I also just faced the same problem recently. I post my experience in case it helps others currently facing this issue.

When using the command:

conda env export --from-history

(or any option following conda env) I would get only a [y/N]: in the output and no response.

I found two solutions to solve the issue:

  • conda must itself be installed in that environment (calling it from the base environment results in the empty prompt response)
  • upgrading conda from 4.13.0 to 4.14.0 (in that environment) conda update conda

huangapple
  • 本文由 发表于 2020年1月3日 18:13:01
  • 转载请务必保留本文链接:https://go.coder-hub.com/59576686.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定