2012-06-13 42 views
3

我試圖讓lesson18.py從pyOpenGL例子成exe文件,但編譯時,它提供此錯誤:pyOpenGL EXE給AttributeError的

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

+0

我得到確切同樣的錯誤有類似的腳本 – eglaser

+0

我仍然有同樣的問題,當時的@ Python 2.7版(股票Mac OS)中,PyOpenGL: 3.0.2b2,pyinstaller 2.0 – kosta5

回答

2

我找到了一個解決這個特定的問題!

這是關於PyOpenGL版本。 Pyinstaller可以正常工作,使用PyOpenGL 3.0.1b1版本

您可以在這裏下載: http://sourceforge.net/projects/pyopengl/files/PyOpenGL/並自行編譯。不要忘記從站點包文件夾中刪除舊的PyOpenGL版本!您可以檢查PyOpenGL的活躍版本的系統上執行以下操作:

>>>import pkg_resources 
>>>pkg_resources.get_distribution("PyOpenGL").version 
>>>'3.0.1b1'