0

我刚刚在亚马逊 EC2 实例(ubuntu 14.04)上安装了 OpenCV 3.2.0。当我尝试运行任何示例程序时,我收到错误 Gtk-WARNING **: cannot open display: :0.0 “在线类似问题的答案对我不起作用”。我试过 了export DISPLAY=:0.0 export DISPLAY=:0 ,我试过xhost +localhost了,收到了xhost: unable to open display ":0.0"

这篇文章描述了与我完全相同的问题,但我没有使用 Vagrant,所以没有“Vagrantfile”,我不知道 EC2 实例中的等价物是什么。 Gtk-WARNING **:无法打开显示:

有谁知道为什么会这样?

4

1 回答 1

1

我在 Ubuntu 16.04 上使用 ssh 连接到 Ubuntu 16.04.2 服务器。我可以执行以下操作:

xhost +
ssh -Y -i .ssh/my.pem ubuntu@ecxxxxxxx.eu-west-1.compute.amazonaws.com
sudo apt install x11-apps
xclock

这会在我的本地显示器上启动 xclock 小程序。请注意我 ssh 之前的 xhost + 和 ssh 命令上的 -Y 标志。我正在使用 xclock 来测试我从 x11-apps 安装的。您应该能够以类似的方式启动 OpenCV。

于 2017-07-21T23:09:58.243 回答