Ryan Goldstein
Ryan Goldstein

Reputation: 543

Add a python flag cx_freeze to executable

I'm making a game using pyglet, which runs like a tortoise (~30-35 FPS) unless I pass the -O flag to python when running it (which gives me a smooth 60FPS). I'm planning on using cx_freeze to distribute it, but I need the -O flag to be used every time the game is run. Any ideas?

Upvotes: 1

Views: 688

Answers (1)

John Lyon
John Lyon

Reputation: 11420

You can use the same -O flag when you run cx_freeze to generate your final build, meaning that the cx_freeze generated bytecode will already be optimized. From the cxfreeze docs:

cxfreeze hello.py --target-dir dist Further customization can be done using the following options: ...

-O optimize generated bytecode as per PYTHONOPTIMIZE; use -OO in order to remove doc strings

Upvotes: 1

Related Questions