gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 17:40:45 24 4
gpt4 key购买 nike

我正在使用 pyglet 制作一个游戏,它的运行就像乌龟一样(~30-35 FPS),除非我在运行它时将 -O 标志传递给 python(这给了我一个流畅的 60FPS)。我计划使用 cx_freeze 来分发它,但我需要在每次运行游戏时使用 -O 标志。有什么想法吗?

最佳答案

当您运行cx_freeze来生成最终版本时,您可以使用相同的-O标志,这意味着cx_freeze生成的字节码已经被优化。来自 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

关于python - 将 python 标志 cx_freeze 添加到可执行文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30586143/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com