How do I make an executable from a Python script? Leave a comment

See cx_Freeze for a distutils extension that permits you to create console and GUI executables from Python code. py2exe, the preferred extension for constructing Python 2.x-based executables, doesn’t but assist Python 3 however a model that does is in growth.

Utilizing cx_Freeze

cx_Freeze creates standalone executables from Python scripts, with the identical efficiency, is cross-platform and will work on any platform that Python itself works on.

There are three other ways to make use of cx_Freeze:

  1. Use the included cxfreeze script.
  2. Create a distutils setup script. That is helpful for those who want further choices when freezing your program, as a result of it can save you them within the script. Run 
     to generate a easy setup script.
  3. Work immediately with the lessons and modules used internally by cx_Freeze. This needs to be reserved for classy scripts or extending or embedding.

cx_Freeze usually produces a folder containing an executable file to your program, together with the shared libraries (DLLs or .so recordsdata) wanted to run it. You may make a easy Home windows installer utilizing a setup script with the 

 possibility, or a Mac disk picture with 
. For a extra superior Home windows installer, use a separate software like Inno Setup to bundle the recordsdata cx_Freeze collects.

Python modules to your executables are saved in a zipper file. Packages are saved within the file system by default however can be included within the zip file.


py2exe is a Python Distutils extension which converts Python scripts into executable Home windows applications, in a position to run with out requiring a Python set up.

Growth is hosted on GitHub. You will discover the mailing listsvn, and downloads for Python 2 there. Downloads for Python 3 are on PyPI.

py2exe was initially developed by Thomas Heller who nonetheless makes contributions. Jimmy Retzlaff, Mark Hammond, and Alberto Sottile have additionally made contributions. Code contributions are all the time welcome from the neighborhood and many individuals present invaluable assistance on the mailing record and the Wiki.

py2exe is utilized by BitTorrentSpamBayes, and hundreds extra – py2exe averages over 5,000 downloads monthly.

In an effort to restrict Wiki spam, this entrance web page isn’t editable. Be at liberty to edit different pages with content material related to py2exe. You’ll need an account to edit (however to not learn) and your account info will probably be used just for the needs of administering this Wiki.

The previous py2exe website remains to be accessible till that info has discovered its method into this wiki.

Leave a Reply

%d bloggers like this: