錯誤來源
安裝好 anaconda 之后新建環境之后直接激活環境 conda activate myenv
錯誤原因
conda 自己已經寫的很明白了:
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'.
意思就是當前 shell 沒激活 conda activate
命令,需要激活。
解決方法
激活命令
Windows:conda init <SHELL_NAME>
SHELL_NAME 替換成當前的shell名稱,比如 Windows 一般是 conda init cmd.exe
Linux:一般是 source activate
踩坑記錄
曾經天真的我只運行了 conda init
,然后一直沒激活成功。。