我正在尝试将 pyOpenGL 示例中的课程 18.py 制作为 exe,但是在编译时会出现此错误:
Traceback (most recent call last):
File "<string>", line 46, in <module>
File "C:\pyinstaller-1.5.1\iu.py", line 436, in importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\pyinstaller-1.5.1\iu.py", line 521, in doimport
exec co in mod.__dict__
File "pyinstall\build\pyi.win32\lesson18\outPYZ1.pyz/OpenGL.GL", line 3, in <m
odule>
File "C:\pyinstaller-1.5.1\iu.py", line 436, in importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\pyinstaller-1.5.1\iu.py", line 521, in doimport
exec co in mod.__dict__
File "pyinstall\build\pyi.win32\lesson18\outPYZ1.pyz/OpenGL.GL.VERSION.GL_1_1"
, line 10, in <module>
File "C:\pyinstaller-1.5.1\iu.py", line 477, in importHook
mod = self.doimport(nm, ctx, ctx+'.'+nm)
File "C:\pyinstaller-1.5.1\iu.py", line 521, in doimport
exec co in mod.__dict__
File "pyinstall\build\pyi.win32\lesson18\outPYZ1.pyz/OpenGL.arrays", line 22,
in <module>
File "pyinstall\build\pyi.win32\lesson18\outPYZ1.pyz/OpenGL.arrays.formathandl
er", line 28, in loadAll
File "pyinstall\build\pyi.win32\lesson18\outPYZ1.pyz/OpenGL.arrays.formathandl
er", line 35, in loadPlugin
File "pyinstall\build\pyi.win32\lesson18\outPYZ1.pyz/OpenGL.plugins", line 14,
in load
File "pyinstall\build\pyi.win32\lesson18\outPYZ1.pyz/OpenGL.plugins", line 28,
in importByName
File "C:\pyinstaller-1.5.1\iu.py", line 436, in importHook
mod = _self_doimport(nm, ctx, fqname)
File "C:\pyinstaller-1.5.1\iu.py", line 521, in doimport
exec co in mod.__dict__
File "pyinstall\build\pyi.win32\lesson18\outPYZ1.pyz/OpenGL.arrays.vbo", line
430, in <module>
AttributeError: 'module' object has no attribute 'GL_READ_WRITE'
Press any key to continue . . .
所有使用 pyOpenGL 的程序(包括我自己的程序)都会发生这种情况,错误是一样的。
是否有任何其他技巧(导入等)可以使用 pyInstaller 制作工作可执行文件(我知道有 py2exe,但我更喜欢 pyInstaller)?
我的 python 版本是 2.7 pyOpenGL 版本:3.0.2a5 pyinstaller 版本:1.5.1