无法连接到任何X显示器:Google Colab运行时

时间:2019-06-07 09:37:38

标签: git google-colaboratory labelimg

我现在正在处理分类问题,并尝试在线进行所有操作,而不必访问我的本地计算机。 因此,我已将数据添加到驱动器,并将驱动器安装在Colab上。现在,我要注释数据,并决定使用LabelImg注释器。我将git克隆到Colab,并尝试按照步骤建议的方式启动它。但是我被打错了。 尽管查看了其他类似的答案,我还是无法解决问题

要克隆和启动的代码:

import os
os.chdir('/content')
!git clone 'https://github.com/tzutalin/labelImg.git'
os.chdir('/content/labelImg')
!sudo apt-get install pyqt5-dev-tools
!sudo pip3 install -r requirements/requirements-linux-python3.txt
!make qt5py3
!python3 labelImg.py
!python3 labelImg.py ['/content/labelImg'] []

错误(以及编译说明):

Reading package lists... Done
Building dependency tree       
Reading state information... Done
pyqt5-dev-tools is already the newest version (5.10.1+dfsg-1ubuntu2).
The following package was automatically installed and is no longer required:
  libnvidia-common-410
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 8 not upgraded.
Requirement already satisfied: pyqt5==5.10.1 in /usr/local/lib/python3.6/dist-packages (from -r requirements/requirements-linux-python3.txt (line 1)) (5.10.1)
Requirement already satisfied: lxml==4.2.4 in /usr/local/lib/python3.6/dist-packages (from -r requirements/requirements-linux-python3.txt (line 2)) (4.2.4)
Requirement already satisfied: sip<4.20,>=4.19.4 in /usr/local/lib/python3.6/dist-packages (from pyqt5==5.10.1->-r requirements/requirements-linux-python3.txt (line 1)) (4.19.8)
pyrcc5 -o libs/resources.py resources.qrc
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
qt.qpa.screen: QXcbConnection: Could not connect to display 
Could not connect to any X display.
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
qt.qpa.screen: QXcbConnection: Could not connect to display 
Could not connect to any X display.

1 个答案:

答案 0 :(得分:1)

从错误消息中,这是因为LabelImg使用QT。

QT是一个GUI库,只能在您的本地计算机上运行。您不能在云中运行它,然后让它在计算机上打开QT窗口。

您可能需要找到另一个使用Web界面的标签库。