如何在 VScode 中配置 Python 的交互式命令环境

如题所述

vscode调试python是可以控制台交互的

下载vscode的扩展“Python”

查看一下这个扩展的官方说明 DonJayamanne/pythonVSCode
按照说明在调试的时候选择 Integrated Terminal/Console
设置python目录:在用户设置里找到
"python.pythonPath": "python",

在右侧修改,如:
"python.pythonPath": "C:/Users/zyc/AppData/Local/Programs/Python/Python35/Python.exe"

然后点旁边的齿轮按钮打开launch.json,找到Integrated Terminal/Console对应的设置修改
{
"name": "Integrated Terminal/Console",
"type": "python",
"request": "launch",
"stopOnEntry": true,
"pythonPath": "${config.python.pythonPath}",
"program": "${file}",
"cwd": "${workspaceRoot}",
"console": "integratedTerminal",
"debugOptions": [
"WaitOnAbnormalExit",
"WaitOnNormalExit"
]
},

应该就可以了
温馨提示:答案为网友推荐,仅供参考
相似回答