Python cx_Freeze for two or more python files (modules)

做~自己de王妃 提交于 2019-12-01 20:33:17

问题


There are example to build executable using one py file(module) as given here I have about 4 py files(modules), I would like to build executable which should include all the py files.

How to build python executable when we have more then one python modules ?

Example from here

    from cx_Freeze import setup, Executable

setup(
        name = "hello",
        version = "0.1",
        description = "the typical 'Hello, world!' script",
        executables = [Executable("hello.py")])

This has hello.py if I have two files like hello1.py and hello2.py ?

Thanks


回答1:


If your hello.pyfile import those files - hello1.py and hello2.py, then this line:

executables = [Executable("hello.py")])

is quite enough.

But if any of those files are separate script file, then you should do like this:

from cx_Freeze import setup, Executable

setup(
        name = "hello",
        version = "0.1",
        description = "the typical 'Hello, world!' script",
        executables = [Executable("hello.py"), Executable("hello1.py"), Executable("hello2.py")]
)

It will create 3 .exe files, for each one of your scripts.



来源:https://stackoverflow.com/questions/35172483/python-cx-freeze-for-two-or-more-python-files-modules

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