How do I clone a conda environment from one python release to another?

后端 未结 2 1965
广开言路
广开言路 2020-12-13 14:11

I have a python 2.7 conda environment and would like to create an equivalent environment with python 3.4. I am aware of the --clone option when creating enviro

相关标签:
2条回答
  • 2020-12-13 15:02

    One way would be to

    conda list --export > exported-packages.txt
    

    And then edit that file to remove the last part of each package with the py27_0 parts (you might also want to remove the versions, in case some version of a package doesn't have a Python 3 version). Then

    conda create -n py3clone --file exported-packages.txt
    

    Another idea would be to clone the environment:

    conda create -n clonedenv --clone oldenv
    conda install -n clonedenv python=3.4
    conda update -n clonedenv --all
    

    Note that obviously both of these will fail if you have some package that doesn't have a Python 3 version.

    0 讨论(0)
  • 2020-12-13 15:13

    I tried this and had a lot of issues with plot.ly being updated to v. 4. My code was written on 3.10 and didn't feel like changing it. I had to copy the whole environment (every single file from \envs) from one machine to next, it works.

    0 讨论(0)
提交回复
热议问题