问题
I have a new PC and I want to clone a Python environment from my older computer.
I created the Python environment about two years ago using Anaconda 2 for Python 2.7. I am having trouble copying it exactly, because some of the packages are no longer available in the same versions and locations. I want to know if there is a way to copy the environment directly from one computer to another, rather than installing each package from a weblink (that in some cases no longer exists).
I have tried several methods to copy it to my new computer including:
running the same installs I did the first time
creating a txt file of all the package sources using:
conda list --explicit > spec-file.txt
on the old computer and then:
conda create --name myenv --file spec-file.txt
on the new computer
creating a yml environment file using:
conda env export > environment.yml
on the old computer and then:
conda env create -f environment.yml
on the new computer
All of these three options fail because some of the packages can no longer be found at the original links. Of course, I can install the new versions of the packages, but the dependencies are different and I am having trouble restoring the same functionality.
I have found one similar post on this topic, noting "this issue seems to defeat the purpose of saving the environment in the first place"! But no one has yet suggested a solution.
Any advice greatly appreciated. Thank you!
来源:https://stackoverflow.com/questions/53639076/how-to-clone-an-old-python-conda-environment-when-links-to-packages-no-longer-w