簡體   English   中英

ImportError:在處理異常時運行`from pyglet.gl import *`時發生錯誤:找不到庫“GL”

[英]ImportError: Error occured while running `from pyglet.gl import *` while handling exception :Library “GL” not found

當我在 docker 中運行強化任務時,我的 python 代碼無法呈現。 當我收到導入錯誤時,我嘗試安裝 GL,但它仍然給我同樣的錯誤。 有沒有其他方法可以解決這個問題而不會弄亂 package 管理器?

錯誤信息:

/usr/local/lib/python3.7/site-packages/gym/logger.py:30: UserWarning: WARN: Box bound precision lowered by casting to float32
warnings.warn(colorize('%s: %s'%('WARN', msg % args), 'yellow'))
Episode 0
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/lbforaging/foraging/rendering.py", line 33, in <module>
  from pyglet.gl import *
File "/usr/local/lib/python3.7/site-packages/pyglet/gl/__init__.py", line 95, in <module>
  from pyglet.gl.lib import GLException
File "/usr/local/lib/python3.7/site-packages/pyglet/gl/lib.py", line 149, in <module>
  from pyglet.gl.lib_glx import link_GL, link_GLU, link_GLX
File "/usr/local/lib/python3.7/site-packages/pyglet/gl/lib_glx.py", line 45, in <module>
  gl_lib = pyglet.lib.load_library('GL')
File "/usr/local/lib/python3.7/site-packages/pyglet/lib.py", line 164, in load_library
  raise ImportError('Library "%s" not found.' % names[0])
ImportError: Library "GL" not found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "if.py", line 106, in <module>
  env.render()
File "/usr/local/lib/python3.7/site-packages/lbforaging/foraging/environment.py", line 501, in render
  self._init_render()
File "/usr/local/lib/python3.7/site-packages/lbforaging/foraging/environment.py", line 494, in 
 _init_render
from .rendering import Viewer
File "/usr/local/lib/python3.7/site-packages/lbforaging/foraging/rendering.py", line 41, in <module>
  """
ImportError:
Error occured while running `from pyglet.gl import *`
HINT: make sure you have OpenGL install. On Ubuntu, you can run 'apt-get install python-opengl'.
If you're running on a server, you may need a virtual frame buffer; something like this should work:
'xvfb-run -s "-screen 0 1400x900x24" python <your_script.py>'

pip3 install GL說要求已經滿足,並給出相同的錯誤“GL not found”和pip3 install OpenGL給出:

ERROR: Could not find a version that satisfies the requirement OpenGL
ERROR: No matching distribution found for OpenGL

您需要舊版本的 pyglet; 通過 pip 安裝它應該可以解決問題:

pip install pyglet==1.5.11

此處進一步討論:

https://github.com/openai/gym/issues/2101

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM