How can you “clone” a conda environment into the root environment?

前端 未结 4 948
深忆病人
深忆病人 2020-12-04 14:15

I\'d like the root environment of conda to copy all of the packages in another environment. How can this be done?

4条回答
  •  失恋的感觉
    2020-12-04 15:02

    When setting up a new environment and I need the packages from the base environment in my new one (which is often the case) I am building in the prompt a identical conda environment by using a spec-file.txt with:

    conda list --explicit > spec-file.txt
    

    The spec-file includes the packages of for example the base environment.

    Then using the prompt I install the the packages into the new environment:

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

    The packages from base are then available in the new environment.

    The whole process is describe in the doc: https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#building-identical-conda-environments

提交回复
热议问题