我在Linux Manjaro中安装了Visual Studio Code和Python扩展。当我尝试启动Python脚本时,外部终端打开,但是在5s之后,我在一个窗口中收到一条错误消息,告诉我“超时”并且我的脚本没有启动。
我在Windows 10上看到this发布了同样的问题,但修复似乎不适用于Manjaro。任何想法?
这是我的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 (Integrated Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "Python: Remote Attach",
"type": "python",
"request": "attach",
"port": 5678,
"host": "localhost",
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "."
}
]
},
{
"name": "Python: Module",
"type": "python",
"request": "launch",
"module": "enter-your-module-name-here",
"console": "integratedTerminal"
},
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/IA_TD2.py",
"console": "integratedTerminal",
"args": [
"runserver",
"--noreload",
"--nothreading"
],
"django": true
},
{
"name": "Python: Flask",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "app.py"
},
"args": [
"run",
"--no-debugger",
"--no-reload"
],
"jinja": true
},
{
"name": "Python: Current File (External Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "externalTerminal"
},
{
"name": "Python: Current File (None)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "none"
}
]
}
不幸的是,VSCode与每个终端都不兼容,而且它似乎与你使用KDE桌面环境的Linux Manjaro安装兼容。
切换到另一个终端肯定会解决这个问题(即GNOME终端)。我不确定,如果没有安装GNOME桌面环境,gnome-terminal
包是可用的。
Here是一个很好的解决方案,如何在不重新安装整个操作系统的情况下完成此操作。