问题
创建了一个新环境openne,退出mac终端后,再重新打开终端,想登陆新环境,出现错误提示。
Last login: Sat Jul 18 17:49:44 on ttys001
xxx@xxx ~ % conda activate openne
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
To initialize your shell, run
$ conda init <SHELL_NAME>
Currently supported shells are:
- bash
- fish
- tcsh
- xonsh
- zsh
- powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
原因
必须先进入默认环境,再退出,再操作。
解决方案
先进入默认环境base,退出默认环境,再进入自定义环境openne。
xxx@xxx ~ % source activate
(base) xxx@xxx ~ % conda deactivate
xxx@xxx ~ % conda activate openne
(openne) xxx@xxx~ %
在此基础上,再切换至另一个自定义环境 embedding,就不需要重新进入默认环境 base 了,退出当前环境 openne,直接用 conda activate embedding 即可。
(openne) xxx@xxx ~ % conda deactivate
xxx@xxx ~ % conda activate embedding
(embedding) xxx@xxx ~ %