无法连接到任何 X 显示器:Google Colab 运行-time
Could not connect to any X display: Google Colab Run-time
我现在正在处理一个分类问题,并尝试在线完成所有操作,而无需访问我的本地计算机。
所以我已经将我的数据添加到驱动器并将我的驱动器安装在 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.
从报错信息来看,是因为LabelImg使用了QT
QT 是一个 GUI 库,只能 运行 在您的本地计算机上。你不能运行它在云端,然后让它在你的机器上打开一个QTwindow。
您可能需要寻找另一个使用 web-interface 的标签库。
我现在正在处理一个分类问题,并尝试在线完成所有操作,而无需访问我的本地计算机。 所以我已经将我的数据添加到驱动器并将我的驱动器安装在 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.
从报错信息来看,是因为LabelImg使用了QT
QT 是一个 GUI 库,只能 运行 在您的本地计算机上。你不能运行它在云端,然后让它在你的机器上打开一个QTwindow。
您可能需要寻找另一个使用 web-interface 的标签库。