use*_*014 6 opengl glfw glx xvfb
我试图使问题尽可能重现。因此,这是docker命令:
docker run --name headless_test -ti python:3.6-jessie /bin/bash
Run Code Online (Sandbox Code Playgroud)
在docker内部执行以下行:
apt update && apt install -y git xvfb xorg-dev cmake
pip3 install glfw
mkdir /projects
git clone https://github.com/glfw/glfw.git /projects/glfw
cd /projects/glfw
cmake -DBUILD_SHARED_LIBS=ON .
make
export PYGLFW_LIBRARY=/projects/glfw/src/libglfw.so
xvfb-run python -c "import glfw; glfw.init(); glfw.window_hint(glfw.VISIBLE, False); glfw.create_window(100, 100, 'hidden window', None, None)"
Run Code Online (Sandbox Code Playgroud)
失败并显示以下错误:
GLX: Failed to find a suitable GLXFBConfig
Run Code Online (Sandbox Code Playgroud)
执行xvfb-run glxinfo
(在安装之后mesa-utils
)将返回以下内容:
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
Error: couldn't find RGB GLX visual or fbconfig
Run Code Online (Sandbox Code Playgroud)
编辑:如果我使用ubuntu
泊坞窗,这很好用