【解决方案】解决ImportError: Library “GLU“ not found.问题

简介: 【解决方案】解决ImportError: Library “GLU“ not found.问题

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。

sudo apt-get update

重新安装python-opengl即可

apt-get install python-opengl
目录
相关文章
codeblocks中出现#error This file requires compiler and library support for the错误时的解决方案
codeblocks中出现#error This file requires compiler and library support for the错误时的解决方案
782 0
codeblocks中出现#error This file requires compiler and library support for the错误时的解决方案
|
8月前
|
机器学习/深度学习 并行计算 安全
ImportError: DLL load failed while importing libpaddle: 找不到指定的模块问题
【6月更文挑战第7天】ImportError: DLL load failed while importing libpaddle: 找不到指定的模块问题
1053 0
|
9月前
|
机器学习/深度学习 并行计算 安全
ImportError: DLL load failed while importing libpaddle: 找不到指定的模块。问题处理
【5月更文挑战第12天】ImportError: DLL load failed while importing libpaddle: 找不到指定的模块。问题处理
2722 0
|
Python
【python3.6】pyinstaller报错AssertionError: Failed to determine matplotlib‘s data directory!【解决方案】
【python3.6】pyinstaller报错AssertionError: Failed to determine matplotlib‘s data directory!【解决方案】
316 0
|
网络安全 Python Windows
ImportError: DLL load failed while importing _ssl: 找不到指定的模块。
找到Anaconda3\pkgs\python-3.8.12-h900ac77_2_cpython\DLLs下的_ssl.pyd文件,查阅在该环境上安装的python版本号,下载python寻找对应的_ssl.pyd覆盖到上述目录中,即可解决问题。
1114 0
|
Perl
library not found for -lPods 的解决办法
在老项目工程中使用cocoapods,可能会报这个错误:library not found for -lPods . 导致这个错误可能有两个原因,这两个原因在编译过程中都是有蛛丝马迹可循的。
1757 0
|
Python
ImportError: DLL load failed while importing qhull: 找不到指定的模块。问题解决!
ImportError: DLL load failed while importing qhull: 找不到指定的模块。问题解决!
785 0
成功解决OSError: dlopen() failed to load a library: cairo / cairo-2 / cairo-gobject-2 / cairo.so.2
成功解决OSError: dlopen() failed to load a library: cairo / cairo-2 / cairo-gobject-2 / cairo.so.2
成功解决OSError: dlopen() failed to load a library: cairo / cairo-2 / cairo-gobject-2 / cairo.so.2

热门文章

最新文章