简体   繁体   English

在 anaconda 中克隆基础环境

[英]Clone base environment in anaconda

My conda version is 4.7.11.我的 conda 版本是 4.7.11。 I am trying to clone the base env to a new one so I can install some specific packages and will not mess up the base environment.我正在尝试将基础环境克隆到一个新环境,以便我可以安装一些特定的软件包并且不会弄乱基础环境。 I tried as some other answers suggested:我按照其他一些答案的建议进行了尝试:

conda create --name <myenv> --clone base

and

conda create --name <myenv> --clone root

But none of them works.但它们都不起作用。 The message from terminal is "The system cannot find the file specified".来自终端的消息是“系统找不到指定的文件”。

Below is my cuurent env list:以下是我当前的环境列表:

base                  *  D:\LabTest\Dave\Anaconda
dlc-windowsCPU           D:\LabTest\Dave\Anaconda\envs\dlc-windowsCPU
dlc-windowsGPU           D:\LabTest\Dave\Anaconda\envs\dlc-windowsGPU
dlc-windowsGPU-dave      D:\LabTest\Dave\Anaconda\envs\dlc-windowsGPU-dave
dlc-windowsGPU-yc        D:\LabTest\Dave\Anaconda\envs\dlc-windowsGPU-yc

I also cannot clone from my anaconda navigator.我也无法从我的 anaconda 导航器中克隆。

Don't know what to do.不知道该怎么办。

您只需要引用称为base而不是root的基本环境:

conda create --name <myenv> --clone base

I would recommend that you try the method as shown on this official documentation .我建议您尝试使用此官方文档中显示的方法。 In summary, you can get all the list of modules installed in the virtual environment, save it as a .txt file, and create a new environment from that .txt file.总之,您可以获得虚拟环境中安装的所有模块列表,将其保存为.txt文件,然后从该.txt文件创建一个新环境。 For example,例如,

conda list --explicit > spec-file.txt

Then, create a new environment using that specification.然后,使用该规范创建一个新环境。

conda create --name myenv --file spec-file.txt

While this is not exactly "cloning" the base environment, you should be able to reproduce a virtual environment identical to the base through this process.虽然这并不是完全“克隆”基础环境,但您应该能够通过此过程重现与基础环境相同的虚拟环境。

What I usually do when creating new env is the below command:创建新环境时我通常做的是以下命令:

conda create --clone pytorch --name pytorch1.6

Where pytorch is the environment that I am cloning to pytorch1.6 which I'll be updating to the latest nightly build.其中 pytorch 是我克隆到 pytorch1.6 的环境,我将更新到最新的每晚构建。 My reason for cloning is to avoid configuration of Cuda all over again :) Documentation or rather official cheatsheet lives here我克隆的原因是为了避免再次配置 Cuda :) 文档或官方备忘单都在这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM