vscode 调试 python 时提示无法将 "conda" 项识别为 cmdlet, 函数, 脚本文件或可运行程序的名称的解决方法
VS 调试时提示如下信息:
conda : 无法将 "conda" 项识别为 cmdlet, 函数, 脚本文件或可运行程序的名称. 请检查名称的拼写, 如果包括路径, 请确保路径
正确, 然后再试一次.
所在位置 行: 1 字符: 1
解决办法:
没有添加系统变量, 所有系统根本识别不了 conda 命令, 找不到位置, 所以添加以下系统变量:
添加对应 Anaconda 环境变量到用户变量中:(以自己的安装路径为准):
我的是:D:\Anaconda
D:\Anaconda\Scripts
D:\Anaconda\Library\bin
示例见下图:
添加好后重启 VS 即可.
如果重启 vscode 调试后提示下面的信息:PS D:\Python>D:/Anaconda/Scripts/activate
PS D:\Python>conda activatebase
CommandNotFoundError:Yourshell hasnotbeen properly configured touse'conda activate'.
Ifyour shellisBashoraBournevariant,enable condaforthe current userwith
$ echo". D:\Anaconda/etc/profile.d/conda.sh">>~/.bashrc
or,forall users,enable condawith
$ sudo ln-s D:\Anaconda/etc/profile.d/conda.sh/etc/profile.d/conda.sh
Theoptions above will permanently enable the'conda'command,but theydoNOT
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 下即可.
来源: http://www.bubuko.com/infodetail-2972895.html