简体   繁体   中英

Cloning environment with selected packages in conda

I would like to know if it is possible to clone an environment with the selected packages only.

Doing conda create -n name --clone base will clone the base environment including all the packages which sometimes unnecessary for a certain project.

Uninstalling the packages on the new environment could be a solution but I'm trying to find a way that is more effective and explicit.

Expanding on what @darthbith said. Cloning creates an exact copy of every package in the environment. If you want to clone only a portion of the environment, you can create a spec file using:

conda list -n base --export > environment.yaml

This will dump a list of every package in the base environment as a yaml file. You can edit the file to keep only the packages you want and conda will figure out the rest.

此命令生成另一个 conda 环境test1 ,其中包含来自基础软件包的请求包numpy scipy pandas ,而无需下载任何内容:

conda create -n test1 --offline numpy scipy pandas

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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