Search code examples
pythonpython-3.xbytecode

Run Python program without installing required modules


Is there a way to move a my Python program to other computer without the need of re installing all the required module?

Maybe by compilation?


Solution

  • I think you're looking for PyInstaller. By definition, PyInstaller is a program that converts (packages) Python programs into stand-alone executables, under Windows, Linux, Mac OS X, Solaris and AIX.

    PyInstaller as of this writing, doesn't support Python 3. There is however this page on freezing your code or shipping:

    Solution    | Windows | Linux | OS X | Python 3 | License | One-file mode | Zipfile import | Eggs | pkg_resources support
    bbFreeze    | yes     | yes   |  yes | no       | MIT     | no            | yes            | yes  | yes
    py2exe      | yes     | no    | no   | no       | MIT     | yes           | yes            | no   | no
    pyInstaller | yes     | yes   | yes  | no       | GPL     | yes           | no             | yes  | no
    cx_Freeze   | yes     | yes   | yes  | yes      | PSF     | no            | yes            | yes  | no
    

    See cx_Freeze's documentation here.