如何使用pygame构建Python 3.4.3源代码到exe?

时间:2015-10-17 07:47:35

标签: python python-3.x compilation pygame

您好我如何使用Pygame库将python 3.4.3源代码构建到exe文件(独立)? (py2exe,没有工作。)任何建议?谢谢

1 个答案:

答案 0 :(得分:1)

关于您的评论,您的设置似乎有问题。你必须告诉py2exe要包括什么。

有一个有用的解释如何获得一个独立的exe以及如何管理包括:http://pythontips.com/2014/03/03/using-py2exe-the-right-way/

本网站的整体示例如下所示:

String.intern()

你必须致电

from distutils.core import setup
import py2exe, sys, os

sys.argv.append('py2exe')

DATA=[('imageformats',['C:\\Python27/Lib/site-packages/PyQt4/plugins/imageformats/qjpeg4.dll',
'C:\\Python27/Lib/site-packages/PyQt4/plugins/imageformats/qgif4.dll',
'C:\\Python27/Lib/site-packages/PyQt4/plugins/imageformats/qico4.dll',
'C:\\Python27/Lib/site-packages/PyQt4/plugins/imageformats/qmng4.dll',
'C:\\Python27/Lib/site-packages/PyQt4/plugins/imageformats/qsvg4.dll',
'C:\\Python27/Lib/site-packages/PyQt4/plugins/imageformats/qtiff4.dll'
])]

setup(
    options = {'py2exe': {'bundle_files': 1, 'compressed': True,"includes":["sip"]}},
    windows = [{'script': "main.py"}],
    zipfile = None,
    data_files = DATA,
)

获取独立的exe。