0

我试图在 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: Current FilePython: Terminal(Integrated)中运行调试,我会收到以下错误消息:

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 处于空闲状态。

非常感谢任何帮助。

4

1 回答 1

0

我想到了。

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

于 2018-05-05T05:54:01.303 回答