本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《
1.背景介绍
今天使用租的云服务器跑强化学习代码,遇到了问题ImportError: Library “GLU” not found。
Traceback (most recent call last):
File "/root/miniconda3/lib/python3.8/site-packages/gym/envs/classic_control/rendering.py", line 27, in <module>
from pyglet.gl import *
File "/root/miniconda3/lib/python3.8/site-packages/pyglet/gl/__init__.py", line 95, in <module>
from pyglet.gl.gl import *
File "/root/miniconda3/lib/python3.8/site-packages/pyglet/gl/gl.py", line 45, in <module>
from pyglet.gl.lib import link_GL as _link_function
File "/root/miniconda3/lib/python3.8/site-packages/pyglet/gl/lib.py", line 149, in <module>
from pyglet.gl.lib_glx import link_GL, link_GLU, link_GLX
File "/root/miniconda3/lib/python3.8/site-packages/pyglet/gl/lib_glx.py", line 46, in <module>
glu_lib = pyglet.lib.load_library('GLU')
File "/root/miniconda3/lib/python3.8/site-packages/pyglet/lib.py", line 168, in load_library
raise ImportError('Library "%s" not found.' % names[0])
ImportError: Library "GLU" not found.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "TrainMaze.py", line 2, in <module>
from MazeEnv import Maze
File "/home/my-mcpg/MazeEnv.py", line 5, in <module>
from gym.envs.classic_control import rendering
File "/root/miniconda3/lib/python3.8/site-packages/gym/envs/classic_control/rendering.py", line 29, in <module>
raise ImportError(
ImportError:
Error occurred while running `from pyglet.gl import *`
HINT: make sure you have OpenGL installed. 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>'
2.解决方案
报错提示中有一个提示信息:
HINT: make sure you have OpenGL installed. On Ubuntu, you can run 'apt-get install python-opengl'.
意思就是说确保安装了OpenGL库,在Ubuntu中,可以通过apt-get install python-opengl命令来安装。所以,操作如下:
apt-get install python-opengl
但使用上述命令时又遇到了一个其他问题:
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python-opengl
解决方案:使用sudo权限,更新apt-get。
重新安装python-opengl即可
apt-get install python-opengl
【python3.6】pyinstaller报错AssertionError: Failed to determine matplotlib‘s data directory!【解决方案】
【python3.6】pyinstaller报错AssertionError: Failed to determine matplotlib‘s data directory!【解决方案】
米码收割机
win10 install tensorflow error:Loaded runtime CuDNN library: 7102 but source was compiled with 7005
win10 install tensorflow error:Loaded runtime CuDNN library: 7102 but source was compiled with 7005
AIEarth
【解决方案】成功解决ERROR: Could not build wheels for opencv-python, which is required to install pyproject.toml-based projects报错信息
成功解决ERROR: Could not build wheels for opencv-python, which is required to install pyproject.toml-based projects报错信息
机器不学习我学习
PyCharm使用opencv错误解决办法:ModuleNotFoundError: No module named 'cv2'/ImportError: DLL load failed
PyCharm使用opencv错误解决办法:ModuleNotFoundError: No module named 'cv2'/ImportError: DLL load failed
成功解决ERROR: Unable to find the development tool `make` in your path; please make sure that you have t
成功解决ERROR: Unable to find the development tool `make` in your path; please make sure that you have t
一个处女座的程序猿
成功解决ERROR: Unable to find the development tool `cc` in your path; please make sure that you have the
成功解决ERROR: Unable to find the development tool `cc` in your path; please make sure that you have the
一个处女座的程序猿