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下!