How can I make a Python script standalone executable to run without ANY dependency?

后端 未结 19 2786
眼角桃花
眼角桃花 2020-11-21 04:51

I\'m building a Python application and don\'t want to force my clients to install Python and modules.

So, is there a way to compile a Python script to be a standalone

19条回答
  •  一个人的身影
    2020-11-21 05:40

    Use py2exe.... use the below set up files:

    from distutils.core import setup
    import py2exe
    
    from distutils.filelist import findall
    import matplotlib
    
    setup(
        console = ['PlotMemInfo.py'],
    
        options = {
            'py2exe': {
                'packages': ['matplotlib'],
                'dll_excludes': ['libgdk-win32-2.0-0.dll',
                                 'libgobject-2.0-0.dll',
                'libgdk_pixbuf-2.0-0.dll']
            }
        },
        data_files = matplotlib.get_py2exe_datafiles()
    )
    

提交回复
热议问题