cx_Freeze - how do I convert multiple files into the build folder

后端 未结 2 1300
太阳男子
太阳男子 2021-01-23 03:43

I\'ve made a program which launches another python program using os.startfile().

I wanted to have this as two exe files, launching the second b

2条回答
  •  时光取名叫无心
    2021-01-23 04:31

    It is possible to include two exe in one build with the following method:

    import sys
    from cx_Freeze import setup, Executable
    
    options = {
    'build_exe': {'path': sys.path + ['modules']}
    }
    
    executables = [
        Executable('script_1.py'),
        Executable('script_2.py')]
    
    setup(
        name='two exe in one folder',
        version='0.1',
        description='Two exe in a single build folder',
        options=options,
        executables=executables)
    

    You will probably have to edit this script further but it should produce two exe in the same build folder.

    An example can be found if you go to your python location (where python.exe is) and navigate to the Lib\site-packages\cx_Freeze\samples\advanced location where you should find a script called setup.py, take a look at it, your answer should be there.

    The exe in Cx_Freeze have dependencies. By copying the exe you are only copying part of the program.

提交回复
热议问题