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

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/BearKChan/article/details/78758687

vscode调试python是可以控制台交互的
1. 下载vscode的扩展“Python”
2. 查看一下这个扩展的官方说明DonJayamanne/pythonVSCode
3. 按照说明在调试的时候选择 Integrated Terminal/Console
4. 设置python目录:在用户设置里找到
"python.pythonPath": "python",
在右侧修改,如:
"python.pythonPath": "C:/Users/zyc/AppData/Local/Programs/Python/Python35/Python.exe"
5. 然后点旁边的齿轮按钮打开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"
            ]
        },

猜你喜欢

转载自blog.csdn.net/BearKChan/article/details/78758687