vscode在調試python文件時提示以下信息:python
conda : 沒法將「conda」項識別爲 cmdlet、函數、腳本文件或可運行程序的名稱。請檢查名稱的拼寫,若是包括路徑,請確保路徑正確,而後再試一次。shell
解決辦法:bash
沒有添加系統變量,因此係統根本識別不了conda命令,找不到位置。函數
添加如下系統變量便可正常運行:spa
添加對應Anaconda環境變量到用戶變量中:(以本身的安裝路徑爲準)調試
個人是:code
D:\Anacondablog
D:\Anaconda\Scriptsip
D:\Anaconda\Library\binrem
示例見下圖:
添加好後重啓VS便可。
若是重啓vscode調試後仍是報錯並提示下面的信息:
PS D:\Python> D:/Anaconda/Scripts/activate
PS D:\Python> conda activate base
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'.
If your shell is Bash or a Bourne variant, enable conda for the current user with
$ echo ". D:\Anaconda/etc/profile.d/conda.sh" >> ~/.bashrc
or, for all users, enable conda with
$ sudo ln -s D:\Anaconda/etc/profile.d/conda.sh /etc/profile.d/conda.sh
The options above will permanently enable the 'conda' command, but they do NOT
put conda's base (root) environment on PATH. To do so, run
$ conda activate
in your terminal, or to put the base environment on PATH permanently, run
$ echo "conda activate" >> ~/.bashrc
Previous to conda 4.4, the recommended way to activate conda was to modify PATH in
your ~/.bashrc file. You should manually remove the line that looks like
export PATH="D:\Anaconda/bin:$PATH"
^^^ The above line should NO LONGER be in your ~/.bashrc file! ^^^
這是按照以前的方法在作一遍,不過此次是把以前那三個路徑添加到系統變量的path下!