conda activate激活環境出錯的解決辦法


出現錯誤情況:

今天在使用Anaconda激活python3.6環境的時候出現了如下錯誤:

[zsq@localhost ~]$ 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'.
————————————————
版權聲明:本文為CSDN博主「雲外孤鳥」的原創文章,遵循CC 4.0 BY-SA版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/qq_33825817/article/details/88959785

google一番發現了幾個解決辦法,但是還是沒能成功解決。后面仔細想想,發現是上次ssh連接該服務器使用conda activate python36命令激活環境后未使用conda deactivate退出環境就關閉終端導致的。

發現這個問題后,解決思路就比較明顯了,重新激活一下環境就好了,具體操作如下:

 

# 重新進入虛擬環境
source activate
# 退出虛擬環境
conda deactivate

 

 

最后,重新執行conda activate python36,沒有報錯,成功進入該虛擬環境。

 


免責聲明!

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



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