How to combine multiple .py files into one .exe with Py2Exe

I used PyQt to create a graphical interface for my program, but it has several .py files, 2 are classes, and one runs the code. So I was wondering, how would I combine them into one whole program?

Here is the link to download all the .py files that I will combine: http://www.multiupload.com/CJDL639CTH

+3
source share
2 answers

Shed Skin may turn your program into a fast executable file, but it may not work for your program.

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

The key part:

    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.
+1
source

Use squeeze than ExeMaker Tool . Can use Py2Exe after compression. Never used Py2Exe.

0
source

Source: https://habr.com/ru/post/1523442/


All Articles