Could not find conda environment

喜夏-厌秋 提交于 2019-12-08 15:31:33

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.

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