[英]python VSCode debug not loading
我嘗試通過按綠色的播放按鈕來啟動調試器。 但是,它不啟動該過程嗎? 藍色滑塊一直處於加載狀態,但從未啟動調試。 這是特定於Python的,因為當我調試C或C ++時,它可以正常工作。 我正在使用Python:current文件配置,但是沒有一個配置啟動Debug進程。 調試按鈕的圖片
甚至沒有錯誤消息。 它只是不想啟動調試過程。 以下是我的launch.json文件(請注意:此文件之前一直有效,至今未更改):
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}"
},
{
"name": "Python: Attach",
"type": "python",
"request": "attach",
"localRoot": "${workspaceFolder}",
"remoteRoot": "${workspaceFolder}",
"port": 3000,
"secret": "my_secret",
"host": "localhost"
},
{
"name": "Python: Terminal (integrated)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "Python: Terminal (external)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "externalTerminal"
},
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"runserver",
"--noreload",
"--nothreading"
],
"debugOptions": [
"RedirectOutput",
"Django"
]
},
{
"name": "Python: Flask (0.11.x or later)",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "${workspaceFolder}/app.py"
},
"args": [
"run",
"--no-debugger",
"--no-reload"
]
},
{
"name": "Python: Module",
"type": "python",
"request": "launch",
"module": "module.name"
},
{
"name": "Python: Pyramid",
"type": "python",
"request": "launch",
"args": [
"${workspaceFolder}/development.ini"
],
"debugOptions": [
"RedirectOutput",
"Pyramid"
]
},
{
"name": "Python: Watson",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/console.py",
"args": [
"dev",
"runserver",
"--noreload=True"
]
},
{
"name": "Python: All debug Options",
"type": "python",
"request": "launch",
"pythonPath": "${config:python.pythonPath}",
"program": "${file}",
"module": "module.name",
"env": {
"VAR1": "1",
"VAR2": "2"
},
"envFile": "${workspaceFolder}/.env",
"args": [
"arg1",
"arg2"
],
"debugOptions": [
"RedirectOutput"
]
}
]
}
這是按下調試按鈕時自動生成的終端命令:
PS C:\Users\surya\OneDrive - King's College London\MoreDHCPdata> cd 'c:\Users\surya\OneDrive - King's College London\MoreDHCPdata'; ${env:PYTHONIOENCODING}='UTF-8'; ${env:PYTHONUNBUFFERED}='1'; & 'C:\Users\surya\Anaconda3\python.exe' 'C:\Users\surya\.vscode\extensions\ms-python.python-2018.3.1\pythonFiles\PythonTools\visualstudio_py_launcher.py' 'c:\Users\surya\OneDrive - King''s College London\MoreDHCPdata' '51293' '34806ad9-833a-4524-8cd6-18ca4aa74f14' 'RedirectOutput,RedirectOutput' 'c:\Users\surya\OneDrive - King''s College London\MoreDHCPdata\tester2.py'
>
當然,調試控制台中的消息沒有任何輸出,因為它甚至無法啟動調試...
注意:Debugger過去在Python上運行良好,只是不想再進行調試了,因此此文章。
我面對的問題是通過在環境變量下的path變量中添加C:\\ Windows \\ System32來解決的(在同一位置為python添加路徑)。
您也可能是同一回事。 如果不是,請嘗試在Python:Terminal(Integrated)中調試程序,因為它引發了我一個錯誤“ cmd”,該錯誤未被識別為內部或外部命令,可操作程序或批處理文件。
檢查是否收到類似錯誤或其他錯誤。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.