当我尝试在 vscode 中的 venv 中运行任何 python 脚本时,除了调试工具栏短暂弹出并消失之外,没有任何反应。现在没有任何问题,如果我没有故意改变任何东西,它就无法工作。如果我手动将程序输入到python终端中,我可以正常运行。有没有办法知道 vscode 正在尝试运行什么?
尝试重启 关闭所有文件夹 Ctrl+Shift+n 解释器路径在 venv 中设置为 python
这是我的launch.json
{
"configurations": [
{
"name": "Python Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
},
]
}
这是 VSCode 中的一个错误。
https://github.com/microsoft/vscode/issues/228191
昨天(2024-09-24)已修复,但可能尚未滚动到您正在使用的版本。
您可以切换到 VSCode Insiders 版本,该版本已修复。
或者您可以尝试删除
"console": "integratedTerminal"
选项,我认为与该问题相关。