从备份启动 Anconda3 [英] Launch Anconda3 from backup
问题描述
尝试从 bash 在新计算机上运行 Anaconda 备份,但没有奏效.所以我又下载了Anaconda3.
Tried running Anaconda back up on new computer from bash but it did not work. So I downloaded Anaconda3 again.
我有我被盗电脑的备份.我可以看到 anaconda3 文件夹,在里面我可以找到 envs 文件夹.里面有一个文件夹,用于我的每个环境.不幸的是,当我打开特定的环境文件夹时,我找不到任何 .yml 文件.注意:我之前从未将任何环境导出到 yml 文件中.
I have a backup from my stolen computer. I can see anaconda3 folder and inside I can find envs folder. Inside there is a folder for each of my environments. Unfortunately when I open the specific environment folders, I cannot find any .yml file. Note: I never exported any environment to yml file before.
不幸的是,我无法导入我以前的任何环境,因为我找不到任何 .yml/yaml 文件.
Unfortunately, I cannot import any of my former environments, as I cannot find any .yml/yaml file.
谁能解释一下如何从备份环境(在 envs 文件夹中)查找或生成 yml 文件?
Can anyone shed some light on how to find or generate a yml file from backed up environments (inside envs folder)?
推荐答案
应该能够通过使用前缀(路径)来激活环境:
One should be able to activate the environments by using the prefix (path):
conda activate /path/to/the/backup/anaconda3/envs/foo
在新系统上重新创建它们的一种方法是通过克隆.例如,
One way to possibly recreate them on the new system would be through cloning. For example,
conda create --clone /path/to/the/backup/anaconda3/envs/foo -n foo
或者您可以按照建议执行并转储 YAML:
Or you can do as suggested and dump YAMLs:
## use the `-p` (prefix) flag to specify by path
conda env export -p /path/to/the/backup/anaconda3/envs/foo > foo.yaml
或者,如果要永久安装备份,可以将位置添加到 envs_dirs
,这应该重新启用按名称引用它们:
Alternatively, if the backup is going to be permanently mounted, the location could be added to envs_dirs
, and this should re-enable referring to them by name:
## use `--append` so new environments are not created there
conda config --append envs_dirs /path/to/the/backup/anaconda3/envs
然而,在实践中,这可能会在解析使用绝对路径的动态链接库时出现问题.克隆策略可能会更好.
In practice, however, this may have issues resolving dynamically-linked libraries that used absolute paths. The cloning strategy might be better.
这篇关于从备份启动 Anconda3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!