首页 文章

python VSCode调试没有加载

提问于
浏览
0

我尝试按绿色播放按钮启动调试器 . 但是,它没有启动过程?蓝色滑块继续加载,但它永远不会启动调试 . 这是特定于Python的,因为当我有Debugged C或C时,它工作得很好 . 我正在使用Python:当前文件配置,但没有任何配置启动调试过程 . Picture of the Debug button

甚至没有错误信息;它只是不想启动调试过程 . 以下是我的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"
    },
    {
        "name": "Python: Terminal (external)",
        "type": "python",
        "request": "launch",
        "program": "${file}",
        "console": "externalTerminal"
    },
    {
        "name": "Python: Django",
        "type": "python",
        "request": "launch",
        "program": "${workspaceFolder}/manage.py",
        "args": [
            "runserver",
            "--noreload",
            "--nothreading"
        ],
        "debugOptions": [
            "RedirectOutput",
            "Django"
        ]
    },
    {
        "name": "Python: Flask (0.11.x or later)",
        "type": "python",
        "request": "launch",
        "module": "flask",
        "env": {
            "FLASK_APP": "${workspaceFolder}/app.py"
        },
        "args": [
            "run",
            "--no-debugger",
            "--no-reload"
        ]
    },
    {
        "name": "Python: Module",
        "type": "python",
        "request": "launch",
        "module": "module.name"
    },
    {
        "name": "Python: Pyramid",
        "type": "python",
        "request": "launch",
        "args": [
            "${workspaceFolder}/development.ini"
        ],
        "debugOptions": [
            "RedirectOutput",
            "Pyramid"
        ]
    },
    {
        "name": "Python: Watson",
        "type": "python",
        "request": "launch",
        "program": "${workspaceFolder}/console.py",
        "args": [
            "dev",
            "runserver",
            "--noreload=True"
        ]
    },
    {
        "name": "Python: All debug Options",
        "type": "python",
        "request": "launch",
        "pythonPath": "${config:python.pythonPath}",
        "program": "${file}",
        "module": "module.name",
        "env": {
            "VAR1": "1",
            "VAR2": "2"
        },
        "envFile": "${workspaceFolder}/.env",
        "args": [
            "arg1",
            "arg2"
        ],
        "debugOptions": [
            "RedirectOutput"
        ]
    }
]

}

这是按下调试按钮时自动生成的终端命令:

PS C:\Users\surya\OneDrive - King's College London\MoreDHCPdata> cd 'c:\Users\surya\OneDrive - King's College London\MoreDHCPdata'; ${env:PYTHONIOENCODING}='UTF-8'; ${env:PYTHONUNBUFFERED}='1'; & 'C:\Users\surya\Anaconda3\python.exe' 'C:\Users\surya\.vscode\extensions\ms-python.python-2018.3.1\pythonFiles\PythonTools\visualstudio_py_launcher.py' 'c:\Users\surya\OneDrive - King''s College London\MoreDHCPdata' '51293' '34806ad9-833a-4524-8cd6-18ca4aa74f14' 'RedirectOutput,RedirectOutput' 'c:\Users\surya\OneDrive - King''s College London\MoreDHCPdata\tester2.py'

当然,调试控制台中的消息没有输出,因为它甚至无法启动调试...

注意:调试器过去在Python中运行良好,它只是不想再调试,因此这篇文章 .

1 回答

  • 0

    通过在环境变量下的路径变量中添加 C:\Windows\System32 (我们为python添加路径的相同位置),我面临同样的问题 .

    你也可能也是这样 . 如果没有,尝试调试 Python:Terminal(Integrated) 中的程序,因为它给我一个错误'cmd'不被识别为内部或外部命令,可操作程序或批处理文件 .

    检查是否有任何类似的错误或不同的东西 .

相关问题