在 VS 代码中调试 Python 不起作用

Debugging Python in VS code not working

我正在尝试在 VS Code 中调试我的 python 脚本,但调试器甚至没有启动。单击绿色播放按钮后,蓝色条继续加载,下面应该变成橙色的条没有改变,仍然是蓝色的。

我尝试了什么? 1. 添加 launch.json 文件中的路径。 这是我的 launch.json 文件。

{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
    {
        "name": "Python: Current File",
        "type": "python",
        "request": "launch",
        "program": "${file}"
    },
    {
        "name": "Python: Attach",
        "type": "python",
        "request": "attach",
        "localRoot": "${workspaceFolder}",
        "remoteRoot": "${workspaceFolder}",
        "port": 3000,
        "secret": "my_secret",
        "host": "localhost"
    },
    {
        "name": "Python: Terminal (integrated)",
        "type": "python",
        "request": "launch",
        "program": "${file}",
        "console": "integratedTerminal",
        "pythonPath": "${config:python.pythonPath}"
    },
    {
        "name": "Python: Terminal (external)",
        "type": "python",
        "request": "launch",
        "program": "${file}",
        "console": "externalTerminal",
        "pythonPath": "${config:python.pythonPath}"
    },

我已经在 Windows 高级设置和 VS 代码工作区设置中正确配置了路径。

{
"python.pythonPath": "C:/Users/Admin/AppData/Local/Programs/Python/Python36-32/python.exe",
"code-runner.runInTerminal": true
}

如果我尝试 运行 Python 中的调试:当前文件Python:终端(集成),我收到此错误消息:

C:\Users\Admin\Documents\PycharmProjects\Python_small_test\CSV_parser>cd c:\Users\Admin\Documents\PycharmProjects\Python_small_test\CSV_parser && cmd /C "set "PYTHONIOENCODING=UTF-8" && set "PYTHONUNBUFFERED=1" && C:/Users/Admin/AppData/Local/Programs/Python/Python36-32/python.exe C:\Users\Admin\.vscode\extensions\ms-python.python-2018.4.0\pythonFiles\PythonTools\visualstudio_py_launcher.py c:\Users\Admin\Documents\PycharmProjects\Python_small_test\CSV_parser 49947 34806ad9-833a-4524-8cd6-18ca4aa74f14 RedirectOutput,RedirectOutput c:\Users\Admin\Documents\PycharmProjects\Python_small_test\CSV_parser\test.py "

'cmd' is not recognized as an internal or external command,operable program or batch file.

当我在 Python: Terminal(external) 中尝试 运行 时,IDE 处于空闲状态。

非常感谢任何帮助。

我明白了。

我只需要在高级系统设置下的环境变量中的路径变量中添加路径"C:\Windows\System32"。