If you specify the optimize option in your setup.py this will only be used for the compiling of the needed modules, not for your main module! If you have the following setup.py:

from distutils.core import setup import py2exe

setup(

)

The bytecode embedded in the resulting .exe will not be optimised. To get optimised bytecode, you need to call the setup.py like so: python -OO setup.py py2exe