首先,需要一个给 py2exe 使用的 python 脚本,我命名为 setup.py,内容如下:
并对 main.py 做简单的处理
最后,执行如下命令:
python setup.py py2exe
.........................................................
关于 py2exe
简介
py2exe is a Python Distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python installation.
下载
http://sourceforge.net/projects/py2exe/
1from distutils.core import setup
2import glob, shutil
3import py2exe
4setup(windows=["main.py"])
5shutil.copytree('SFX', 'dist/SFX')
6shutil.copytree('Image', 'dist/Image')
7shutil.copyfile('C:/Python25/Lib/site-packages/pygame/freesansbold.ttf', 'dist/freesansbold.ttf')
2import glob, shutil
3import py2exe
4setup(windows=["main.py"])
5shutil.copytree('SFX', 'dist/SFX')
6shutil.copytree('Image', 'dist/Image')
7shutil.copyfile('C:/Python25/Lib/site-packages/pygame/freesansbold.ttf', 'dist/freesansbold.ttf')
并对 main.py 做简单的处理
1#font = pygame.font.Font(None, 40)
2 font = pygame.font.Font('freesansbold.ttf', 40)
2 font = pygame.font.Font('freesansbold.ttf', 40)
最后,执行如下命令:
python setup.py py2exe
.........................................................
关于 py2exe
简介
py2exe is a Python Distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python installation.
下载
http://sourceforge.net/projects/py2exe/