我有这个pyopengl应用程序,我试图用bbfreeze冻结它。不幸的是,当我运行冻结的应用程序时,它出错了:
Traceback (most recent call last):
File "<string>", line 6, in <module>
File "__main__.py", line 128, in <module>
File "__main__client__.py", line 11, in <module>
File "ui.py", line 15, in <module>
File "OpenGL/GLUT/__init__.py", line 2, in <module>
File "OpenGL/raw/GLUT/__init__.py", line 6, in <module>
File "OpenGL/raw/GLUT/constants.py", line 7, in <module>
File "OpenGL/platform/__init__.py", line 36, in <module>
File "OpenGL/platform/__init__.py", line 27, in _load
File "OpenGL/plugins.py", line 14, in load
File "OpenGL/plugins.py", line 28, in importByName
ImportError: No module named glx
这是必需的版本信息:
Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import OpenGL
>>> OpenGL.__version__
'3.0.1b2'
>>> import bbfreeze
>>> bbfreeze.version
(0, 97, 3)
我正试图在同一台机器上运行它我正在冻结它,解冻的应用程序在该机器上运行正常。
有没有人设法做到这一点?或者可能提供一些调试指导?
尝试将“OpenGL.platform.glx”明确添加到冻结中包含的模块列表中。我认为bbfreeze选项“包含”就是你想要的。
更新:看看PyInstaller的做法:http://www.pyinstaller.org/browser/trunk/PyInstaller/hooks/hook-OpenGL.py
您可能需要将所有这些模块添加到包含列表中。
在阅读该文件之前,我也面临同样的挑战,该文件指出:
bbfreeze has been tested with python 2.4, 2.5 and 2.6. bbfreeze will not work with python versions prior to 2.3 as it uses the zipimport feature introduced with python 2.3.
所以我认为最好的办法是使用提到的python版本!希望这可以帮助!