Search code examples
pythoncx-freeze

Converting .py file to exe with cx_Freeze


It was converting my .py file to .exe file perfectly fine before, but somehow now it is showing the following errors:

WARNING: Tried to load multiple incompatible Qt wrappers. Some incorrect files may be copied.
Traceback (most recent call last):
File "setmeup.py", line 5, in
executables = [Executable("SciKit-Play-GUI.py")])

followed by some errors in cx_Freeze files in my directory...... Please HELP!


Solution

  • to convert a .py in exe you can use py2exe

    use this command to compile :

    setup.py py2exe
    

    here is the setup.py file

    from distutils.core import setup
    import py2exe, sys, os
    
    sys.argv.append('py2exe')
    
    setup(    
        name = "...",
        version = '1.0',
        description = "...",
        author = "...",
        windows = [{'script': 'test.py'#, 'icon_resources': [(1, 'icon.ico')]
                    }],
        zipfile = None,
        data_files=[],
        options = {
            'py2exe': {
                'optimize':2, 
                'bundle_files': 3,      
                'compressed': True, 
                'excludes':[],
                #'dll_excludes':['w9xpopen.exe']
                }
            }
    )