Python 3.x VS代码:";“不允许使用属性调试选项”;
我正在尝试学习Python并设置VS Code的Python调试器,如本视频所述: 然而,讲师似乎在VS代码1.18上,而我在1.28上。我将launch.json配置设置为它在视频中的显示方式,但我在“debugOptions”下得到一条绿线,表示“不允许使用属性debugOptions”。任何人都知道我如何设置我的环境,使其按照讲师解释的方式工作。我在Windows10上Python 3.x VS代码:";“不允许使用属性调试选项”;,python-3.x,visual-studio-code,vscode-settings,vscode-debugger,Python 3.x,Visual Studio Code,Vscode Settings,Vscode Debugger,我正在尝试学习Python并设置VS Code的Python调试器,如本视频所述: 然而,讲师似乎在VS代码1.18上,而我在1.28上。我将launch.json配置设置为它在视频中的显示方式,但我在“debugOptions”下得到一条绿线,表示“不允许使用属性debugOptions”。任何人都知道我如何设置我的环境,使其按照讲师解释的方式工作。我在Windows10上 { // Use IntelliSense to learn about possible attributes. //
{
// 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",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config:python.pythonPath}",
"program": "${file}",
"cwd": "",
"env":{},
"envFile": "${workspaceRoot}/.env",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit",
"RedirectOuput"
]
},
{
"name": "Python: Attach",
"type": "python",
"request": "attach",
"port": 5678,
"host": "localhost"
},
{
"name": "Python: Module",
"type": "python",
"request": "launch",
"module": "enter-your-module-name-here",
"console": "integratedTerminal"
},
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"console": "integratedTerminal",
"args": [
"runserver",
"--noreload",
"--nothreading"
],
"django": true
},
{
"name": "Python: Flask",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "app.py"
},
"args": [
"run",
"--no-debugger",
"--no-reload"
],
"jinja": true
},
{
"name": "Python: Current File (External Terminal)",
"type": "python",
"request": "launch",
"program": "",
"console": "externalTerminal"
}
]
}而不是
"debugOptions": [
"RedirectOutput"
],
使用
等等。检查是否有正确的配置选项(以及是否需要)。在第一眼看来,我似乎找不到前两个选项,考虑一下你是否需要它,如果是谷歌的话。
然后,您的第一个配置块将是
{
"name": "Python",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config:python.pythonPath}",
"program": "${file}",
"cwd": "",
"env":{},
"envFile": "${workspaceRoot}/.env",
"redirectOutput": true,
},
“调试选项”已从较新版本的配置选项中删除
"redirectOutput": true,
{
"name": "Python",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config:python.pythonPath}",
"program": "${file}",
"cwd": "",
"env":{},
"envFile": "${workspaceRoot}/.env",
"redirectOutput": true,
},