How would I combine multiple .py files into one .exe with Py2Exe

北慕城南 提交于 2019-11-28 00:26:57

Shed Skin can turn your program into a fast executable, but maybe that doesn't work for your program.

With py2exe and a setup.py like this you can easily turn your Python 2.x code in Windows into an executable with only one extra file, unlike cx_Freeze's flat output of 11 files. For Python 3, use cx_Freeze, or py2exe.

The key part is:

    options={
            'py2exe': {
                    'compressed': 2,
                    'optimize': 2,
                    'includes': includes,
                    'excludes': excludes,
                    'packages': packages,
                    'dll_excludes': dll_excludes,
                    'bundle_files': 1,  # 1 = .exe; 2 = .zip; 3 = separate
                    'dist_dir': 'dist',  # Put .exe in dist/
                    'xref': False,
                    'skip_archive': False,
                    'ascii': False,
                    'custom_boot_script': '',
                    #'unbuffered': True,  # Immediately flush output.
            }
    },
    zipfile=None,  # Put libs into .exe to save space.

Use squeeze than ExeMaker Tool. May be able to use Py2Exe after squeeze. Have never used Py2Exe.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!