在 GitLab 中创建 pyqt 构建 [英] Create a pyqt build in GitLab
问题描述
我正在 pyqt4
中制作一个程序,使用 python3.4
并托管在 Gitlab 上.当我试图进行构建时,它会失败.这是我项目中的 .gitlab-ci.yml
文件:
I'm making a program in pyqt4
, using python3.4
and host on Gitlab. When I'm trying to make a build this fails.
This is the .gitlab-ci.yml
file form my project:
before_script:
- apt-get update -qy
- apt-get install -y python3 python3-dev python3-pip python3-pyqt4
- export DISPLAY=:0.0
test:
script:
- python3 main.py
错误是:main.py: cannot connect to X server: 0.0
.我正在尝试没有 export DISPLAY=:0.0
而什么都没有
The error is: main.py: cannot connect to X server: 0.0
. I am trying without export DISPLAY=:0.0
and nothing
推荐答案
如果 PyQt5 是一个选项,Qt 5 有最小"平台插件.要使用它,请修改传递给 QApplication 的 argv 以包含 ['-platform', 'minimal'].
If PyQt5 is an option, Qt 5 has the "minimal" platform plugin. To use it, modify the argv passed to QApplication to include ['-platform', 'minimal'].
(参考:https://stackoverflow.com/a/35355906/829568)
对于 PyQt4,您可以使用虚拟 X 服务器:
For PyQt4, you could use a virtual X Server:
sudo apt-get install xvfb
xvfb-run python render.py
(参考:https://stackoverflow.com/a/13215192/829568)
这篇关于在 GitLab 中创建 pyqt 构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!