如何修复“ ImportError:无法加载EGL库”,22,版本可解释。

时间:2019-05-24 17:19:12

标签: python exception opengl pyopengl

下午好,我想使用pyrender模块从python 3D模型中生成渲染图像。因此,我使用了Code

--------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
C:\Anaconda3\lib\site-packages\OpenGL\platform\egl.py in EGL(self)
     69                 'EGL',
---> 70                 mode=ctypes.RTLD_GLOBAL
     71             )

C:\Anaconda3\lib\site-packages\OpenGL\platform\ctypesloader.py in loadLibrary(dllType, name, mode)
     44     try:
---> 45         return dllType( name, mode )
     46     except Exception as err:

C:\Anaconda3\lib\ctypes\__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
    347         if handle is None:
--> 348             self._handle = _dlopen(self._name, mode)
    349         else:

OSError: [WinError 126] Le module spécifié est introuvable

During handling of the above exception, another exception occurred:

ImportError                               Traceback (most recent call last)
<ipython-input-1-e86166a3612b> in <module>()
      4 import numpy as np
      5 import trimesh
----> 6 import pyrender
      7 
      8 # Load the FUZE bottle trimesh and put it in a scene

C:\Anaconda3\lib\site-packages\pyrender\__init__.py in <module>()
      1 from .camera import (Camera, PerspectiveCamera, OrthographicCamera,
      2                      IntrinsicsCamera)
----> 3 from .light import Light, PointLight, DirectionalLight, SpotLight
      4 from .sampler import Sampler
      5 from .texture import Texture

C:\Anaconda3\lib\site-packages\pyrender\light.py in <module>()
      9 
     10 from .utils import format_color_vector
---> 11 from .texture import Texture
     12 from .constants import SHADOW_TEX_SZ
     13 from .camera import OrthographicCamera, PerspectiveCamera

C:\Anaconda3\lib\site-packages\pyrender\texture.py in <module>()
      6 import numpy as np
      7 
----> 8 from OpenGL.GL import *
      9 
     10 from .utils import format_texture_source

C:\Anaconda3\lib\site-packages\OpenGL\GL\__init__.py in <module>()
      1 """OpenGL.GL, the core GL library and extensions to it"""
      2 # early import of our modules to prevent import loops...
----> 3 from OpenGL import error as _error
      4 from OpenGL.GL.VERSION.GL_1_1 import *
      5 from OpenGL.GL.pointers import *

C:\Anaconda3\lib\site-packages\OpenGL\error.py in <module>()
     10 import logging
     11 _log = logging.getLogger( 'OpenGL.error' )
---> 12 from OpenGL import platform, _configflags
     13 from ctypes import ArgumentError
     14 __all__ = (

C:\Anaconda3\lib\site-packages\OpenGL\platform\__init__.py in <module>()
     33     return plugin
     34 
---> 35 _load()
     36 
     37 def types(resultType,*argTypes):

C:\Anaconda3\lib\site-packages\OpenGL\platform\__init__.py in _load()
     30 
     31     # install into the platform module's namespace now
---> 32     plugin.install(globals())
     33     return plugin
     34 

C:\Anaconda3\lib\site-packages\OpenGL\platform\baseplatform.py in install(self, namespace)
     90         """Install this platform instance into the platform module"""
     91         for name in self.EXPORTED_NAMES:
---> 92             namespace[ name ] = getattr(self,name,None)
     93         namespace['PLATFORM'] = self
     94         return self

C:\Anaconda3\lib\site-packages\OpenGL\platform\baseplatform.py in __get__(self, obj, cls)
     12         self.fget = function
     13     def __get__( self, obj, cls ):
---> 14         value = self.fget( obj )
     15         setattr( obj, self.fget.__name__, value)
     16         return value

C:\Anaconda3\lib\site-packages\OpenGL\platform\egl.py in GetCurrentContext(self)
     91     @baseplatform.lazy_property
     92     def GetCurrentContext( self ):
---> 93         return self.EGL.eglGetCurrentContext

C:\Anaconda3\lib\site-packages\OpenGL\platform\baseplatform.py in __get__(self, obj, cls)
     12         self.fget = function
     13     def __get__( self, obj, cls ):
---> 14         value = self.fget( obj )
     15         setattr( obj, self.fget.__name__, value)
     16         return value

C:\Anaconda3\lib\site-packages\OpenGL\platform\egl.py in EGL(self)
     71             )
     72         except OSError as err:
---> 73             raise ImportError("Unable to load EGL library", *err.args)
     74     @baseplatform.lazy_property
     75     def getExtensionProcedure( self ):

ImportError: ('Unable to load EGL library', 22, 'Le module spécifié est introuvable', None, 126, None, 'EGL', None)

当我运行此代码来生成图像时。我遇到了这个错误:

order by str_to_date(concat('2000-01-01 ', substring_index(str, ' - ', 1)), '%Y-%m-%d %h:%i %p'),
         str_to_date(concat('2000-01-01 ', substring_index(str, ' - ', -1)), '%Y-%m-%d %h:%i %p')

我在python中安装了所有必要的模块,例如pyrender模块,但我不明白问题出在哪里。 这里是pyrender工作的链接:link

3 个答案:

答案 0 :(得分:0)

您可以尝试

apt-get install libglfw3-dev libgles2-mesa-dev

这解决了我的问题。 希望对您有帮助。

答案 1 :(得分:0)

就我而言(Ubuntu 18.04,pyrender == 1.43,python == 3.7.8),

sudo apt-get install libosmesa6-dev
sudo apt-get install freeglut3-dev

解决了问题。 也许第一行不是必需的。

答案 2 :(得分:0)

如果您使用的是 Windows,只需注释掉您指定 PYOPENGL_PLATFORM 的行。