安装完manim后
在命令行执行manimgl
遇到
ImportError: ('Unable to load OpenGL library', 'dlopen(OpenGL, 10): image not found', 'OpenGL', None)
参考Unable to load/find OpenGL on MacOS #1372
asierralozano commented on 27 Oct 2020
It looks like the issue is getting a fix python/cpython#21241
In the meantime, you can fix this issue by editing PyOpenGL file OpenGL/platform/ctypesloader.py, and changing the linefullName = util.find_library( name )
to
fullName = '/System/Library/Frameworks/OpenGL.framework/OpenGL'
1.首先找到名为ctypesloader.py
的文件,我的路径是/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/OpenGL/platform/ctypesloader.py
,仅供参考
如果上述路径找不到的话,试试
find / -name ctypesloader.py
.这是一个全局搜索的指令,目的是遍历所有文件夹寻找文件
2.在79行左右的位置,找到fullName = util.find_library( name )
,修改成fullName = '/System/Library/Frameworks/OpenGL.framework/OpenGL'
,如下图所示
**需要注意的是:**你的系统里只有/System/Library/Frameworks/OpenGL.framework
这个路径,而该路径下是没有OpenGL
的,但是/System/Library/Frameworks/OpenGL.framework/OpenGL
依旧其效果,这是因为
DanielAmmar commented on 29 Nov 2020
You don’t actually need the binary there, just change the fullName variable as suggested.
现在去example_scenes.py
所在目录下执行manimgl example_scenes.py OpeningManimExample
,会如下图所示
enjoy it