48

I am new to python and apart from the language itself, I am exploring various aspects of it. in terms of compilation into .exe (so that it can be deployed without installing python too) I checked py2exe, new releases stopped a few years ago. Then pyInstaller, seems to have stopped at python 2.7.

Can I get a list of all python to exe compilers? thanks

Community
  • 1
  • 1
user1866880
  • 1,437
  • 6
  • 18
  • 26
  • 1
    I had an impression that python cannot be compiled effectively due to its dynamic features. yes, there are tools that can produce an exe, but I thought that they rely on a runtime anyways. – akonsu Jan 04 '13 at 21:44
  • 1
    For reference: `pyInstaller` is still under active development, and working on 3.x support, although I have no idea how far away it is. And `py2exe` already supports 3.x (although you have to run it under 2.7). This is just a comment, not an answer—cx_freeze is probably what you want. – abarnert Jan 04 '13 at 22:02
  • @akonsu More or less true, the conclusion is either not true or not relevant. These tools include the runtime (as in, python.dll and all used modules) with the resulting executable, so it does not have dependencies (apart from the right version of the C runtime, I think, but a C executable needs that too). –  Jan 04 '13 at 22:04
  • @akonsu This term is at least ambiguous due to the widespread use in python (just search 'python compiler' on SO) to define several things (p.e there are pyc files as well as compiler module in the library -in py3k a built in compile function). IMHO the OP does not deserve those downvotes (similar posts with similar titles have been highly upvoted on SO). – joaquin Jan 04 '13 at 22:09
  • possible duplicate of [making a python program executable](http://stackoverflow.com/questions/286441/making-a-python-program-executable) – mmmmmm Jan 05 '13 at 10:57

3 Answers3

66
  • pyinstaller for Windows, Linux, and Mac OS X (Python 3.5-3.10)
  • cx_Freeze for Windows, Linux, and Mac OS X (Python 3.6-3.10)
  • bbfreeze for Windows and Linux (Python 2.4-2.7)
  • py2exe for Windows (Python 2.6, 2.7)
  • py2exe for Windows (Python 3.3-3.10)
  • Freeze for Linux and maybe Mac OS X (Python 2.x)
  • py2app for Mac OS X (Python 2.x)
  • Nuitka for Windows, Linux, and MacOS (2.6, 2.7, 3.3-3.9)
Felierix
  • 179
  • 3
  • 12
Austin Henley
  • 4,625
  • 13
  • 45
  • 80
  • 2
    `bbfreeze` also doesn't work for 3.x, I believe `freeze` doesn't either, and `py2exe` just barely does. Implying that `pyinstaller` is the only one on your list that doesn't work for 3.x is misleading—especially since the OP pretty strongly implied that he wants 3.x support. (And the only one of your answers that works fine for 3.x is `py2app`, which isn't going to help the OP on Windows.) – abarnert Jan 04 '13 at 22:05
  • pyinstaller now supports 3.3-3.5 :) – meawoppl Dec 22 '15 at 19:34
  • 1
    Successfully complied a Python 3.6 script using the "develop" branch of Pyinstaller (Github). – tivnet Sep 06 '17 at 14:06
  • 1
    [http://pytoexe.com/](http://pytoexe.com/) - online (havent tested) – T.Todua Apr 11 '18 at 19:41
  • http://deneskellner.local/sw/rapidexe - I mean, sorry for mentioning a product I've created, but it seems to solve the problem at hand. There's a Python example in the package. – dkellner Oct 13 '18 at 10:35
4

https://github.com/marcelotduarte/cx_Freeze

Works fine for Python 3.x.

Otherwise you can always make your script run at Python 2.x and use a program that can transform from that version.

Also look up:

Python 3.0.1 Executable Creator

Making a portable (exe) with Python 3.1?

Felierix
  • 179
  • 3
  • 12
  • Also [What technologies exist to create stand alone executables for Python 3?](http://stackoverflow.com/questions/3447093/what-technologies-exist-to-create-stand-alone-executables-for-python-3). – abarnert Jan 04 '13 at 21:54
3

I've had luck using IronPython and the pyc.py tool. You can basically turn your python into .net bytecode and then to an exe.

Felierix
  • 179
  • 3
  • 12
Paul Rubel
  • 26,632
  • 7
  • 60
  • 80