【解决方案】解决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
目录
相关文章
|
7月前
|
机器学习/深度学习 并行计算 安全
ImportError: DLL load failed while importing libpaddle: 找不到指定的模块。问题处理
【5月更文挑战第12天】ImportError: DLL load failed while importing libpaddle: 找不到指定的模块。问题处理
2501 0
|
6月前
|
机器学习/深度学习 并行计算 安全
ImportError: DLL load failed while importing libpaddle: 找不到指定的模块问题
【6月更文挑战第7天】ImportError: DLL load failed while importing libpaddle: 找不到指定的模块问题
729 0
|
7月前
|
测试技术 iOS开发 Perl
废弃第三方库导致的library not found for -lXXXXX(linker command failed ) 完美解决方法
废弃第三方库导致的library not found for -lXXXXX(linker command failed ) 完美解决方法
117 0
|
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
|
网络安全 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覆盖到上述目录中,即可解决问题。
1060 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错误时的解决方案
742 0
codeblocks中出现#error This file requires compiler and library support for the错误时的解决方案
解决办法:ImportError: No module named google.protobuf.internal
解决办法:ImportError: No module named google.protobuf.internal
222 0
|
Linux
Linux操作系统下proj4库编译与安装及ERROR 6: Unable to load PROJ.4 library (libproj.so)问题解决
Linux操作系统下proj4库编译与安装及ERROR 6: Unable to load PROJ.4 library (libproj.so)问题解决
925 0
|
移动开发 iOS开发
IOS开发错误library not found for -lXXX
IOS开发错误library not found for -lXXX
1132 0
IOS开发错误library not found for -lXXX