1. 程式人生 > >如何在VScode中配置Python的互動式環境

如何在VScode中配置Python的互動式環境

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" ] },