47
votes

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

3
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
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
@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). - user395760
@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
possible duplicate of making a python program executable - mmmmmm

3 Answers

63
votes
  • cx_Freeze for Windows, Linux, and Mac OS X (Python 2.7, 3.x)
  • pyinstaller for Windows, Linux, and Mac OS X (Python 2.7, 3.4-3.7)
  • 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.5)
  • pytoexe for Windows (Python 2, 3)
  • Freeze for Linux and maybe Mac OS X (Python 2.x)
  • py2app for Mac OS X (Python 2.x)
4
votes

http://cx-freeze.sourceforge.net/

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?

3
votes

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.