使用Pyopengl上的Mac M1上的OpenGL库加载问题
我有这些导入
import pygame
from pygame.locals import *
from OpenGL.GL import * # issue with this one
from OpenGL.GLU import *
错误是:
OSError: ("dlopen(OpenGL, 0x000A): tried: '/Users/aryansingh/miniconda3/lib/OpenGL'
错误堆栈:
Traceback (most recent call last):
File "/Users/aryansingh/miniconda3/lib/python3.9/site-
packages/OpenGL/platform/darwin.py", line 35, in GL
return ctypesloader.loadLibrary(
File "/Users/aryansingh/miniconda3/lib/python3.9/site-
packages/OpenGL/platform/ctypesloader.py", line 45, in loadLibrary
return dllType( name, mode )
File "/Users/aryansingh/miniconda3/lib/python3.9/ctypes/__init__.py", line 382, in
__init__
self._handle = _dlopen(self._name, mode)
OSError: ("dlopen(OpenGL, 0x000A): tried:
从此答案中尝试修复:无法在MacOS上的Python中导入OpenGl.gl
site-packages/OpenGL/Platform/ctypesloader.py文件发生错误的情况就是这样:
if isinstance( dllType, ctypes.LibraryLoader ):
dllType = dllType._dlltype
fullName = '/System/Library/Frameworks/OpenGL.framework/OpenGL'#None this path was edited it was none before , LOCALCHANGES
try:
fullName = util.find_library( name )
if fullName is not None:
name = fullName
elif os.path.isfile( os.path.join( DLL_DIRECTORY, name + '.dll' )):
name = os.path.join( DLL_DIRECTORY, name + '.dll' )
except Exception as err:
_log.info( '''Failed on util.find_library( %r ): %s''', name, err )
# Should the call fail, we just try to load the base filename...
pass
try:
return dllType( name, mode )
except Exception as err:
err.args += (name,fullName)
raise
如何解决此问题?
我正在使用: 系统版本:MacOS 12.1(21C52) 内核版本:达尔文21.2.0
i have these imports
import pygame
from pygame.locals import *
from OpenGL.GL import * # issue with this one
from OpenGL.GLU import *
error is :
OSError: ("dlopen(OpenGL, 0x000A): tried: '/Users/aryansingh/miniconda3/lib/OpenGL'
error stack :
Traceback (most recent call last):
File "/Users/aryansingh/miniconda3/lib/python3.9/site-
packages/OpenGL/platform/darwin.py", line 35, in GL
return ctypesloader.loadLibrary(
File "/Users/aryansingh/miniconda3/lib/python3.9/site-
packages/OpenGL/platform/ctypesloader.py", line 45, in loadLibrary
return dllType( name, mode )
File "/Users/aryansingh/miniconda3/lib/python3.9/ctypes/__init__.py", line 382, in
__init__
self._handle = _dlopen(self._name, mode)
OSError: ("dlopen(OpenGL, 0x000A): tried:
tried fix from this answer : Unable to import opengl.gl in python on macos
content of site-packages/OpenGL/platform/ctypesloader.py file where error occurs is like this :
if isinstance( dllType, ctypes.LibraryLoader ):
dllType = dllType._dlltype
fullName = '/System/Library/Frameworks/OpenGL.framework/OpenGL'#None this path was edited it was none before , LOCALCHANGES
try:
fullName = util.find_library( name )
if fullName is not None:
name = fullName
elif os.path.isfile( os.path.join( DLL_DIRECTORY, name + '.dll' )):
name = os.path.join( DLL_DIRECTORY, name + '.dll' )
except Exception as err:
_log.info( '''Failed on util.find_library( %r ): %s''', name, err )
# Should the call fail, we just try to load the base filename...
pass
try:
return dllType( name, mode )
except Exception as err:
err.args += (name,fullName)
raise
How to fix this?
i am using :
System Version: macOS 12.1 (21C52)
Kernel Version: Darwin 21.2.0
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您在正确的道路上。您请更改以下代码:
希望
这对您有所帮助。
I think you were on the right track. You please change your below code:
to
Hope this will help you.