vscode集成终端如何开启x11转发? [英] How to enable x11 forwarding in vscode integrated terminal?

查看:93
本文介绍了vscode集成终端如何开启x11转发?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

X11 转发在 ubuntu 的终端中工作正常.但是如果我尝试在我的 VSCode 终端中从远程运行任何 GUI,它会显示 : cannot connect to X server.

X11 forwarding working fine in ubuntu's terminal. but if I try to run any GUI from a remote in my VSCode terminal, it shows : cannot connect to X server.

有什么建议吗?

推荐答案

我找到了使用菜单栏 runrun without debugging 选项的解决方案.我们只需要配置 launch.json 文件并使用此命令从客户端 pc 打开终端 ssh -Y -i ~/.ssh/Key.pem username@server.

I found a solution using the menubar run and run without debugging option. Just we need to configure the launch.json file and open a terminal from the client pc with this command ssh -Y -i ~/.ssh/Key.pem username@server.

在我的例子中 launch.json 看起来像这样:

In my case launch.json looks like this:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "args": ["--target", "dataset", "--output", "dataset_softmax", "--nChannel", "32", "--minLabels", "8", "--filetype", "png"],
            "console": "integratedTerminal",
            "env": {
                "DISPLAY": "localhost:10.0"
            },
        }
    ]
}

这篇关于vscode集成终端如何开启x11转发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆