As of PyOpenGL 3.0, add the following to any of your python files to get py2exe to work.

Pyopengl Tutorial

Pyopengl examples

The following was not necessary for me.

Pyopengl Glut


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.


PyOpenGL is the cross platform Python binding to OpenGL and related APIs. The binding is created using the SWIG wrapper generator, and is provided under an extremely liberal BSD-style Open-Source license. PyOpenGL includes support for OpenGL v1.1, GLU, GLUT v3.7, GLE 3, WGL 4, and Togl (Tk OpenGL widget) 1.6. I already know the basic,such as creating window,changing window title, set window icon,setting perspective and drawing object and lastly manipulating object. But i need a pyopengl tutorial that teach me about lighting and camera and many more open. PyOpenGL-安装与测试 1,目的.


Pyopengl Install

  • In your, exclude OpenGL although you have PyOpenGL installed. I needed to explicitly include ctypes and logging to make it work, but maybe that depends on what things you use. My

  • At the top of your main Python file, add the current directory ('.') to your sys.path:

  • Run py2exe.

  • Copy the OpenGL folder from PYTHONDIRLibsite-packages to your new dist directory. I think it's in C:Python26Libsite-packages by 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.

Pyopengl Qt

--- Bram Geron