RuntimeError: Failed to initialize OpenGL
如果要用
mujoco_py
的
render()
获取相机图片,需要去掉
viewer = mujoco_py.MjViewer(sim)
对象,同时,要把环境变量中的
LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libGLEW.so
也去掉,否则会出现如下的报错
...
File "mjsim.pyx", line 149, in mujoco_py.cymj.MjSim.render
File "mjsim.pyx", line 151, in mujoco_py.cymj.MjSim.render
File "mjrendercontext.pyx", line 43, in mujoco_py.cymj.MjRenderContext.__init__
File "mjrendercontext.pyx", line 99, in mujoco_py.cymj.MjRenderContext._setup_opengl_context
File "opengl_context.pyx", line 128, in mujoco_py.cymj.OffscreenOpenGLContext.__init__
RuntimeError: Failed to initialize OpenGL
参考文献: Setting up mujoco-py
for use with on-screen and off-screen rendering