PyOpenGL¶
As of PyOpenGL 3.0, add the following to any of your python files to get py2exe to work.
The following was not necessary for me.
PyOpenGL is a set of Python bindings for the OpenGL graphical rendering library. It has a page on how to compile with py2exe, but it is outdated. Here's how I made it work for me, although it is quite wasteful in space.
- In your
setup.py, excludeOpenGLalthough you have PyOpenGL installed. I needed to explicitly includectypesandloggingto make it work, but maybe that depends on what things you use. Mysetup.py:
from distutils.core import setup
import py2exe
setup(windows=['opdracht.py'],
options={
"py2exe": {
"includes": ["ctypes", "logging"],
"excludes": ["OpenGL"],
}
}
)
- At the top of your main Python file, add the current directory (
'.') to yoursys.path:
- Run
setup.py py2exe. - Copy the
OpenGLfolder from PYTHONDIR\Lib\site-packagesto your newdist\directory. I think it's inC:\Python26\Lib\site-packagesby default. You can leave out any *.pyc and *.pyo files.
I think that's what did the trick for me, now . If you need funky stuff like TK, WGL, or OpenGLContext, maybe the original tutorial by PyOpenGL helps.
Tested with Python 2.6, py2exe version 0.6.9 and PyOpenGL version 3.0.0.
--- Bram Geron