【问题标题】:How do I combine these two py2exe programs. They are pygame2exe and a pyttsx.exe如何结合这两个 py2exe 程序。它们是 pygame2exe 和 pyttsx.exe
【发布时间】:2014-11-13 17:12:38
【问题描述】:

很抱歉,我以一种有趣的方式提出了这个问题,但是我不知道更好的措辞方式。我正在尝试将其结合起来。

http://www.pygame.org/wiki/Pygame2exe?parent=CookBook

有了这个。

from distutils.core import setup
import py2exe

py2exe_options = { 'includes': ['pyttsx.drivers.sapi5', 'win32com.gen_py.C866CA3A-32F7-11D2-9602-     00C04F8EE628x0x5x4'],
               'typelibs': [('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 4)] }

setup(console=['main.py'], options = {'py2exe': py2exe_options})

如果有人可以提供帮助,我将不胜感激。我尝试的一切都会出错。 谢谢朋友。

【问题讨论】:

    标签: python pygame py2exe


    【解决方案1】:

    使用您链接的 pygame2exe 脚本,您需要将额外包含列表 ['pyttsx.drivers.sapi5', 'win32com.gen_py.C866CA3A-32F7-11D2-9602-00C04F8EE628x0x5x4'] 添加到使用的设置选项中 - 看起来您可以通过覆盖或更改 BuildExe 中的 self.extra_scripts = [] 来做到这一点。然后你还需要对你的typelibs 做类似的事情,认为它看起来像 pygame2exe 不直接支持。

    您最简单的做法可能是获取 pygame2exe 的本地副本,然后修改 BuildExe 类以将您的特定选项添加到此:

    发件人:

    options = {'py2exe': {'optimize': 2, 'bundle_files': 1, 'compressed': True, \
        'excludes': self.exclude_modules, 'packages': self.extra_modules, \
        'dll_excludes': self.exclude_dll,
        'includes': self.extra_scripts} },
    

    到(这可能需要进一步调整:

    options = {'py2exe': {'optimize': 2, 'bundle_files': 1, 'compressed': True, \
        'excludes': self.exclude_modules, 'packages': self.extra_modules, \
        'dll_excludes': self.exclude_dll,
        'includes': self.extra_scripts + ['pyttsx.drivers.sapi5', 'win32com.gen_py.C866CA3A-32F7-11D2-9602-00C04F8EE628x0x5x4'],
        'typelibs': [('{C866CA3A-32F7-11D2-9602-00C04F8EE628}', 0, 5, 4)]
    }},
    

    让我知道你过得怎么样!

    【讨论】:

    • 在这种情况下,请您接受正确的答案。不客气。
    • 我以为我做了 O_o =O
    • 我想你一定是在我评论的同时完成了 - 谢谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多