首页 > 解决方案 > 在 Visual Studio Code 中使用 Python 时出现问题

问题描述

在将 Python 与 Visual Studio Code 结合使用时,我收到以下错误消息:

R:\python>cd r:\python && cmd /C "set "PYTHONIOENCODING=UTF-8" && set "PYTHONUNBUFFERED=1" && "C:/Program Files (x86)/Python36-32/python.exe" C :\Users\smit097.vscode\extensions\ms-python.python-2018.7.1\pythonFiles\PythonTools\visualstudio_py_launcher.py r:\python 50144 34806ad9-833a-4524-8cd6-18ca4aa74f14 RedirectOutput,RedirectOutput r:\python\testhelloworld .py"

'cmd' 不是内部或外部命令、可运行程序或批处理文件。

一段时间后有一个弹出窗口要求我打开launch.json。

仅当我调试并运行新代码时才会弹出此消息。旧代码运行良好,没有错误。

我尝试卸载并重新安装 VSC,但没有运气。

标签: python

解决方案


launch.json通过转到打开调试配置

调试 -> 打开配置

launch.json中,改变

"console": "IntegratedTerminal""console": "none"

我有同样的问题,上面的修复对我有用。您也可以尝试添加

"debugOptions": [
    "RedirectOutput"
]

看看它是否适合你。

资源:

在 .vscode 中调试时遇到问题

VScode 在集成终端而不是调试控制台中开始调试


推荐阅读