pyrender 错误
File "/usr/local/lib/python2.7/dist-packages/pyrender/viewer.py", line 347, in __init__
self._init_and_start_app()
File "/usr/local/lib/python2.7/dist-packages/pyrender/viewer.py", line 995, in _init_and_start_app
height=self._viewport_size[1])
File "/usr/local/lib/python2.7/dist-packages/pyglet/window/xlib/__init__.py", line 170, in __init__
super(XlibWindow, self).__init__(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/pyglet/window/__init__.py", line 595, in __init__
context = config.create_context(gl.current_context)
File "/usr/local/lib/python2.7/dist-packages/pyglet/gl/xlib.py", line 216, in create_context
return XlibContextARB(self, share)
File "/usr/local/lib/python2.7/dist-packages/pyglet/gl/xlib.py", line 322, in __init__
super(XlibContext13, self).__init__(config, share)
File "/usr/local/lib/python2.7/dist-packages/pyglet/gl/xlib.py", line 230, in __init__
raise gl.ContextException('Could not create GL context')
pyglet.gl.ContextException: Could not create GL context
解决方法:
Hi I had a similar issue and fixed it by looking at which OpenGL version I had by calling:
glxinfo | grep OpenGL
>> OpenGL core profile version string: 3.3 (Core Profile) Mesa 19.1.3
Then I changed in the constants.py file in pyrender.py (you can find it wherever you installed pyrender in my case: ~/.local/lib/python3.7/site-packages/pyrender/constants.py)
OPEN_GL_MAJOR = 3
OPEN_GL_MINOR = 3
After that I was able to render :)!
参考链接:
https://github.com/mmatl/pyrender/issues/13#issuecomment-515080934