简体   繁体   English

将python标志cx_freeze添加到可执行文件

[英]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). 我正在使用pyglet制作游戏,该游戏的运行方式类似于乌龟(〜30-35 FPS),除非我在运行时将-O标志传递给python(这样可使我流畅地达到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. 我打算使用cx_freeze分发它,但是我需要在每次运行游戏时都使用-O标志。 Any ideas? 有任何想法吗?

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. 运行cx_freeze生成最终版本时,可以使用相同的-O标志,这意味着cx_freeze生成的字节码将已经优化。 From the cxfreeze docs : cxfreeze文档

cxfreeze hello.py --target-dir dist Further customization can be done using the following options: ... cxfreeze hello.py --target-dir dist可以使用以下选项进行进一步的自定义:...

-O optimize generated bytecode as per PYTHONOPTIMIZE; -O 根据PYTHONOPTIMIZE优化生成的字节码; use -OO in order to remove doc strings 使用-OO以删除文档字符串

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM