Could not find conda environment

倾然丶 夕夏残阳落幕 提交于 2019-12-08 03:12:20

问题


I am trying to re-enter my conda environment but I am having trouble doing so as when I type conda activate (evironment name) or source activate (environment name) both return the error 'Could not find conda environment.' This is very strange as when I type conda info --envs, I get this:

# conda environments:
#
base                  *  /Users/(my name)/anaconda3
                         /anaconda3/envs/(environment name)

回答1:


Names and Prefixes

For a Conda env to have a name it must be installed in one of the envs_dirs directories (see conda config --show envs_dirs). Creating an env outside of one of those forfeits its "name-ability". Instead, you must use the path (called its prefix) to activate it, e.g.,

conda activate /anaconda3/envs/my_env

Other commands will require you to use the --prefix|-p flag to specify the env. See the documentation on "Specifying the location for an environment".

Adding Other Env Locations

If you plan to frequently install in a different location than the default, then there is an option to add directories to the envs_dirs configuration variable. In your case, this would be

conda config --append envs_dirs /anaconda3/envs

Note that whatever you put in here will become the de facto default for future installs using the --name|-n flag. If you still want to keep the usually default (/Users/(my name)/anaconda3/envs), then you should follow the above with

conda config --prepend envs_dirs /Users/(my name)/anaconda3/envs

That is, this will let you pick up the "names" of the envs installed in /anaconda3/envs, but calling conda create -n foo will still create it in /Users/(my name)/anaconda3/envs/foo.

Documentation: conda config --describe envs_dirs.



来源:https://stackoverflow.com/questions/58369030/could-not-find-conda-environment

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!