将使用pygame的python程序编译为可执行文件 [英] compiling a python program that uses pygame into an executable
问题描述
我想将使用pygame的python程序编译为使用py2exe的可执行文件,但是遇到了一些问题.我在Windows命令行中运行脚本,它似乎可以正常工作.它创建了一个dist目录,但是当我尝试打开.exe文件时,它会短暂打开命令行窗口,然后什么也不做.
I wanted to compile my python program that uses pygame into an executable using py2exe but I'm experiencing some problems. I run the script in the windows command line and it seems to work. It creates a dist directory but when I try to open the .exe file, it briefly opens a command line window and then doesn't do anything.
这可能是因为我使用了pygame而py2exe不支持它吗?还是我需要将pygame库的副本放在与程序相同的目录中?
Could this possibly be because I've used pygame and py2exe doesn't support it? Or do I need to put a copy of the pygame library into the same directory as my program?
推荐答案
在pygame Wiki上对此有一个答案: http://pygame.org/wiki/Pygame2exe
要将pygame包含在可执行文件中,您需要编辑BuildExe.__init__
There is an answer to this on the pygame wiki: http://pygame.org/wiki/Pygame2exe
To include pygame in the executable, you will need to edit BuildExe.__init__
这篇关于将使用pygame的python程序编译为可执行文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!