出現錯誤情況
在使用Anaconda激活python3.6環境的時候出現瞭如下錯誤:
$ conda activate python36
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'.
google一番發現了幾個解決辦法,但是還是沒能成功解決。後面仔細想想,發現是上次ssh連接該服務器使用conda activate python36命令激活環境後未使用conda deactivate退出環境就關閉終端導致的。
發現這個問題後,解決思路就比較明顯了,重新激活一下環境就好了,具體操作如下:
重新進入虛擬環境
source activate
重新退出虛擬環境
source deactivate
最後,重新執行conda activate python36,沒有報錯,成功進入該虛擬環境。