You can use:
exe = EXE( pyz, a.scripts, [('O', None, 'OPTION'), ('O', None, 'OPTION')], ...but, whilst it does set sys.flags.optimize to 2, it doesn’t remove either the assertions or docstrings since they need to happen at compile time. You used to be able to use python -OO -m PyInstaller your-code.py but pycparser (one of PyInstaller’s indirect Windows-only dependencies) doesn’t allow it now. That said, -OO mode is a waste of time. Since the docstrings are small and in a PyInstaller application get compressed, you’re looking at about ~0.1% reduction in application size.