mac m1 上的 OpenGL 库加载问题,使用 pyopengl
issue with OpenGL library load on mac m1 , using pyopengl
我有这些进口商品
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:
尝试从这个答案中修复:
发生错误的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)
内核版本:Darwin 21.2.0
我认为您的方向是正确的。请更改以下代码:
fullName = '/System/Library/Frameworks/OpenGL.framework/OpenGL'#None this path was edited it was none before , LOCALCHANGES
try:
fullName = util.find_library( name )
至
fullName = None
try:
fullName = '/System/Library/Frameworks/OpenGL.framework/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:
尝试从这个答案中修复:
发生错误的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) 内核版本:Darwin 21.2.0
我认为您的方向是正确的。请更改以下代码:
fullName = '/System/Library/Frameworks/OpenGL.framework/OpenGL'#None this path was edited it was none before , LOCALCHANGES
try:
fullName = util.find_library( name )
至
fullName = None
try:
fullName = '/System/Library/Frameworks/OpenGL.framework/OpenGL'
希望对您有所帮助。