Anaconda 錯誤:CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'. To initialize your shell, run


錯誤來源

安裝好 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,然后一直沒激活成功。。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM