78

To create executable files (windows) I assume that we should use one of them: Py2exe or PyInstaller.

What are the difference between them?

trante
  • 33,518
  • 47
  • 192
  • 272

3 Answers3

85

Py2exe and PyInstaller both are wrappers but here are few differences that I noticed,

  1. Py2exe is compatible with python2.4+ including python3.0 & 3.1 whereas PyInstaller is currently, compatible with python 2.7 and 3.3–3.5
  2. As far I know, Py2exe didn't support signing whereas Pyinstaller has support for signing from version 1.4
  3. In PyInstaller it is easy to create one exe, By default both create a bunch of exes & dlls.
  4. In py2exe its easier to embed manifest file in exe, useful for run as administrator mode in windows vista and beyond.
  5. Pyinstaller is modular and has a feature of hooks to include files in the build that you like. I don't know about this feature in py2exe.

Hope this helps you in your decision making.

[Update] - It looks like PyInstaller is actively developed (https://github.com/pyinstaller/pyinstaller/) and released. py2exe is still using sourceforge and its release cycle is very random on pypi there is no build after 2014 and their code show development in 2017 as well (https://sourceforge.net/p/py2exe/svn/HEAD/tree/trunk/py2exe-3/py2exe/). So, I recommend using pyinstaller till the time py2exe stabilizes its release cycle in favor of developers.

salastro
  • 17
  • 1
  • 8
Gagandeep Singh
  • 5,755
  • 4
  • 41
  • 60
  • 23
    It should also be mentioned that py2exe is not being actively maintained, the last version (0.6.9) came out in 2008. – Hubro Dec 09 '12 at 14:58
  • 3
    For py2exe: Looks like 0.6.9 is the latest supporting the python 2 line. Support for python 3 continues on pypi (https://pypi.python.org/pypi/py2exe, v0.9.2.2 updated 2014-10-21), though I didn't see this on their wiki... might be somewhere. – otherchirps Jan 04 '15 at 02:19
  • 6
    For pyInstaller - they now claim up to 3.4 compatibility. – Marc Nov 05 '15 at 04:47
  • 3
    py2exe 0.10.1.0 has been released the 8 November 2020. py2exe (for python 3) is now hosted on Github : https://github.com/py2exe/py2exe – Jona Dec 08 '20 at 08:36
  • 2
    Another slight difference: while py2exe supports only Windows executables, pyinstaller supports creating executables for various platforms. From the documentation: "PyInstaller is tested against Windows, Mac OS X, and GNU/Linux. However, it is not a cross-compiler: to make a Windows app you run PyInstaller in Windows; to make a GNU/Linux app you run it in GNU/Linux, etc. PyInstaller has been used successfully with AIX, Solaris, FreeBSD and OpenBSD, but is not tested against them as part of the continuous integration tests." – Boris Modylevsky Dec 21 '20 at 09:53
  • As of August 2023, the commit activity over the last year of pyinstaller is way higher than of py2exe. – d4tm4x Aug 07 '23 at 08:55
6

There is a fork of py2exe that is being actively developed to support ongoing versions of Python, https://github.com/albertosottile/py2exe, currently at v0.9.3.2 which works with Python 3.7.

I've used it on a small project and it works as expected, producing a working executable. Download the correct version from the releases page and install with pip.

Update 2020-11-06:

As per LolPython's comment, this fork now redirects to the official repo so use that instead:

https://github.com/py2exe/py2exe

adejones
  • 960
  • 10
  • 11
  • 1
    Your link is not broken but FYI it now redirects to https://github.com/py2exe/py2exe which indicates that the fork is now the official py2exe project. The project homepage confirms this: https://www.py2exe.org/ includes Alberto Sottile in the list of project contributors. – LolPython Nov 02 '20 at 16:28
3

From the message of the wikipedia,py2exe is not active for long time :

Stable release: 0.9.2.2 for Python 3 /; 21 October 2014; 0.6.9 for Python 2 /; 15 November 2008

So I advise to use the pyinstaller.....

But now the pyinstaller also meet the problemThe offical website of pyinstaller:

Help keeping PyInstaller alive: Maintaining PyInstaller is a huge amount of work. PyInstaller development can only continue if users and companies provide sustainable funding. See Funding PyInstaller for how to support PyInstaller.