【解决方案】解决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
目录
相关文章
|
6天前
|
机器学习/深度学习 并行计算 安全
ImportError: DLL load failed while importing libpaddle: 找不到指定的模块。问题处理
【5月更文挑战第12天】ImportError: DLL load failed while importing libpaddle: 找不到指定的模块。问题处理
61 0
|
9月前
|
Java Android开发
Failed to load JavaHL Library.These are the errors that were encountered:no msvcp100 in java.library
Failed to load JavaHL Library.These are the errors that were encountered:no msvcp100 in java.library
|
11月前
VS2022编译GDAL库报错: fatal error U1050: PROJ_INCLUDE should be defined. PROJ >= 6 is a required depende
VS2022编译GDAL库报错: fatal error U1050: PROJ_INCLUDE should be defined. PROJ >= 6 is a required depende
108 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覆盖到上述目录中,即可解决问题。
562 0
|
并行计算 编译器 TensorFlow
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
138 0
缺少链接库报错:ld: symbol(s) not found for architecture x86_64
缺少链接库报错:ld: symbol(s) not found for architecture x86_64
188 0
【解决方案】成功解决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报错信息
【解决方案】成功解决ERROR: Could not build wheels for opencv-python, which is required to install pyproject.toml-based projects报错信息
codeblocks中出现#error This file requires compiler and library support for the错误时的解决方案
codeblocks中出现#error This file requires compiler and library support for the错误时的解决方案
479 0
codeblocks中出现#error This file requires compiler and library support for the错误时的解决方案
|
Python
ImportError: DLL load failed while importing qhull: 找不到指定的模块。问题解决!
ImportError: DLL load failed while importing qhull: 找不到指定的模块。问题解决!
674 0
(Anaconda)ImportError: DLL load failed while importing win32file: 找不到指定的模块。
(Anaconda)ImportError: DLL load failed while importing win32file: 找不到指定的模块。
(Anaconda)ImportError: DLL load failed while importing win32file: 找不到指定的模块。