如何解决使用cx_Freeze将pygame转换为exe
我以前没有使用pygame的经验,但是通过遵循在线教程,我设法创建了Flappy Bird游戏。我想将脚本转换为.exe文件,以便与朋友共享。我创建了一个setup.py文件,如下所示:
import cx_Freeze
import os
executables = [cx_Freeze.Executable("script.py")]
assets = ['res/assets/' + each for each in os.listdir('C:/Users/MehmetSanisoglu/Desktop/Game/res/assets')]
sounds = ['res/sound/' + each for each in os.listdir('C:/Users/MehmetSanisoglu/Desktop/Game/res/sound')]
files = assets + sounds
files.append('res/04B_19.TTF') #Add the font file
cx_Freeze.setup(
name="Flappy",options={"build_exe": {"packages":['pygame','sys','random'],"include_files":files}},executables = executables
)
但是,当我在script.py和setup.py所在的目录中运行cmd时,在创建的生成文件中找不到“ Flappy.exe”,但是有一个“ script.exe” ”。当我运行script.exe时,它会瞬间打开命令行,在其中可以看到以下几行:
running build
running build_exe
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
,然后什么也没有发生。你能帮我吗? 谢谢
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。