调试时显示cmd is not recognize
并且程序未调试。
可能是什么问题?
我已经检查了 path
和 pythonpath
变量,这些似乎很好
bash
C:\Users\rahul\Desktop\vscode\.vscode>cd c:\Users\rahul\Desktop\vscode\.vscode &&
cmd /C "set "PYTHONIOENCODING=UTF-8" &&
set "PYTHONUNBUFFERED=1" &&
C:\Users\rahul\AppData\Local\Programs\Python\Python37-32\python.exe c:\Users\rahul\.vscode\extensions\ms-python.python-2019.6.22090\pythonFiles\ptvsd_launcher.py --default --client --host localhost
--port 50265 c:\Users\rahul\Desktop\vscode\.vscode\s.py "
'cmd' is not recognized as an internal or external command,
operable program or batch file.
最佳答案
TL;DR:
cmd
is not in your Windows Environment Path. add%SystemRoot%\system32
to your System Variables and restart VSCode.
Visual Studio Code 实际上带来了对选择终端的 native 支持,因此不再需要将 cmd 包含到您的路径中。
- 按
CTRL + SHIFT + P
->终端:选择默认 shell
-> 选择您的终端。
它将将此行添加到您的 settings.json 中:
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe"
应该出现的。
或者,如果您选择 Powershell,它将如下所示:
"terminal.integrated.shell.windows": "C:\\windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
要查看您的 settings.json 文件,只需:
Ctrl + ,
向下滚动到文件:关联
,然后点击在 settings.json 中编辑
。
关于python - 如何修复此 'cmd' 无法识别错误以在 VSCode 中进行调试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56867659/