python - 在 Manjaro 中使用外部终端时出现超时错误

标签 python linux visual-studio-code kde-plasma manjaro

我已经在 Linux Manjaro 中安装了带有 Python 扩展的 Visual Studio Code。当我尝试启动 Python 脚本时,外部终端打开,但 5 秒后我在窗口中收到一条错误消息,告诉我“超时”并且我的脚本没有启动。

我看过 this在 Windows 10 上发布同样的问题,但该修复程序似乎不适用于 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-terminal 包是否可以在不安装 GNOME 桌面环境 的情况下使用。

Here是一个很好的解决方案,您如何在不重新安装整个操作系统的情况下执行此操作。

关于python - 在 Manjaro 中使用外部终端时出现超时错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54652845/

相关文章:

python - 训练/测试矩阵图书交叉推荐系统

python - boto detach_volume 和卸载卷

java - 如何使用java访问名称中包含空格字符的文件?

javascript - 为什么使用 'var' 时 VS Code 的 JavaScript 语法突出显示有所不同?

python - VS code向函数添加参数并将其添加到函数的每次调用中

python - 二维和一维 Numpy 数组的交集

python - 在不破坏可读性的情况下压缩此 Python 语句

c++ - 何时为可执行文件分配内核版本

linux - UNIX编程

python-3.x - 如何在vscode中找到python方法的源代码