This question already has answers here:
Create a directly-executable cross-platform GUI app using Python
(13 answers)
How to deploy Python to Windows users?
(4 answers)
Create a single executable from a Python project [closed]
(3 answers)
Closed 9 years ago.
I've used several modules to make EXEs for Python, but I'm not sure if I'm doing it right.
How should I go about this, and why? Please base your answers on personal experience, and provide references where necessary.
Auto PY to EXE - A .py to .exe converter using a simple graphical interface built using Eel and PyInstaller in Python.
py2exe is probably what you want, but it only works on Windows.
PyInstaller works on Windows and Linux.
Py2app works on the Mac.
I found this presentation to be very helpfull.
How I Distribute Python applications on Windows - py2exe & InnoSetup
From the site:
There are many deployment options for
Python code. I'll share what has
worked well for me on Windows,
packaging command line tools and
services using py2exe and InnoSetup.
I'll demonstrate a simple build script
which creates windows binaries and an
InnoSetup installer in one step. In
addition, I'll go over common errors
which come up when using py2exe and
hints on troubleshooting them. This is
a short talk, so there will be a
follow-up Open Space session to share
experience and help each other solve
distribution problems.
Also known as Frozen Binaries but not the same as as the output of a true compiler- they run byte code through a virtual machine (PVM). Run the same as a compiled program just larger because the program is being compiled along with the PVM. Py2exe can freeze standalone programs that use the tkinter, PMW, wxPython, and PyGTK GUI libraties; programs that use the pygame game programming toolkit; win32com client programs; and more.
The Stackless Python system is a standard CPython implementation variant that does not save state on the C language call stack. This makes Python more easy to port to small stack architectures, provides efficient multiprocessing options, and fosters novel programming structures such as coroutines. Other systems of study that are working on future development: Pyrex is working on the Cython system, the Parrot project, the PyPy is working on replacing the PVM altogether, and of course the founder of Python is working with Google to get Python to run 5 times faster than C with the Unladen Swallow project. In short, py2exe is the easiest and Cython is more efficient for now until these projects improve the Python Virtual Machine (PVM) for standalone files.
Not on the freehackers list is gui2exe which can be used to build standalone Windows executables, Linux applications and Mac OS application bundles and plugins starting from Python scripts.
Use cx_Freeze to make exe your python program
py2exe:
py2exe is a Python Distutils extension which converts Python scripts into executable Windows programs, able to run without requiring a Python installation.
See a short list of python packaging tools on FreeHackers.org.
Related
This question already has answers here:
Create a single executable from a Python project [closed]
(3 answers)
Closed 8 years ago.
I have noticed that there are several commercially available programs I have that are partially made in python, but they worked even before I downloaded python. Do they somehow incorporate the interpreter into the executable? How?
Obviously this is platform dependent, but on Windows for example, the Python on Windows FAQ suggests the following "See http://www.py2exe.org/ for a distutils extension that allows you to create console and GUI executables from Python code."
There are a number of packages out there that bundle a py script with its runtime dependancies (ie python & any 3rd party modules)
py2exe
pyinstaller
cx_freeze
py2exe has sort of died a death (I use to use this)
pyinstaller is in active development and has some very nice features BUT does not support py3 at the moment
cx_freeze is equally nice and does support PY3
My preference right now is pyinstaller and is partly why I have held of fully converting a suite of py programs I have to py3
I'm setting up a scripted build of a cross-platform python app (Python 3) and I'd like to create all the distributables from linux. Is that possible?
Short answer: no
I've been doing something similiar recently (using cx_Freeze with Python 3). If you set up Python inside Wine, you can generate a Windows build, but I had to copy some DLLs in before it worked properly (cx_Freeze calls a Windows API function that's not implemented in Wine). I've not run into any way of packaging applications for Macs without actually having a Mac.
Perhaps someone should set up a community build service so people could build distributables for different platforms for each other. That doesn't get round the problem of testing, though.
I have a wxPython application that is almost done & I would like to place it in my portfolio. I have to consider when someone attempts to run my app that they may not have Python, or wxPython, so if they just click the main script/python file its not going to run, right?
How should I distribute my app (how do you distribute ur apps) so that it can be run & also so that it could be run on the 3 major OS's (Unix, Windows, MacOSX)?
I know of py2exe for releasing under windows, but what can I use for Unix & MacOSX to compile the program? Whats the easiest way?
Use Gui2exe and compress with UPX to get unpacked size down.
For a setup file(exe) with uinstall info Inno-Setup is good.
I have use this with wxpython several times and got it to work on all windows versions.
For Gui2exe use optimize(2) - compressed(2) - Bundle files(3)
Bundle files(3) is the most stable,
Bundle files(1) make one big exe-file.
For one exe-file is better as last step to use Inno-Setup
You can use py2exe for Windows and py2app for Mac. PyInstaller works for Windows and Linux. Personally, I use GUI2Exe, which wraps all three and makes them a little easier to use. Note: I don't have a Mac, so I haven't tried it with that. You can check out my series on freezing Python here:
http://www.blog.pythonlibrary.org/2010/08/10/a-pyinstaller-tutorial-build-a-binary-series/
http://www.blog.pythonlibrary.org/2010/07/31/a-py2exe-tutorial-build-a-binary-series/
http://www.blog.pythonlibrary.org/2010/08/31/another-gui2exe-tutorial-build-a-binary-series/
There are a couple others on the blog too.
I suggest both, script for all platforms and frozen binary for lazy windows users.
To answer your latest question, you don't compile python. Python is an interpreted language, it gets compiled on the fly when run. A python frozen binary is actually the python interpreter with your script hardcoded in it. And frozen binaries are windows-only, AFAIK. Besides, Unix and MacOS (usually) come with python pre-installed.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
Distributing Python programs
I have several source codes for some GUI programs I made in Python. I'd like to distribute them. However, I'd like to make it as easy as possible for the end user to get the program up and running. What are the common way's of going about this problem?
This is in reference to Windows XP and on.
All noteworthy linux distributions and Mac OS come shipped with some version of Python. Windows don't have Python installed by default, so you must install it separately in order to run a Python module. Of course the installed Python version must be the same as your program (version 2 or 3).
The easiest way to distribute your program is to just distribute the source code (e.g. send your module by email or upload it somewhere) but in that case, the target PC must have Python installed and meet the dependencies. An even better solution (at least for the community) is to upload your program as a package on PyPi. More info for that procedure can be found HERE.
In some cases there are reasons that prevent you from using these options. For example you can't install python and/or the dependencies (no root/admin account). If that is the case, you can bundle your module(s) along with everything else that is required to run your program (e.g python*.dll on windows). As far as i know the basic options for this kind of distribution are the following ones:
PyInstaller
briefcase
fbs
PyOxidizer
nuitka --standalone
py2app (only for Mac OS)
cx_Freeze
freeze
py2exe
cython --embed
Another approach would be to use Portable Python or in case of Linux/BSD StaticPython
Note : Not all of the aforementioned tools run on all platforms or/and support Python3. Check their documentation.
Unmaintained ones
bbFreeze
esky (unmaintained)
vendorID
gui2exe
You want py2exe, which is an extension of the distutils package.
http://www.py2exe.org/
What would be the optimal way to develop a basic graphical application for Windows based on a Python console script? It would be great if the solution could be distributed as a standalone directory, containing the .exe file.
As far as I understand your question, you want to write a graphical windows application in Python, to do this I suggest using wxPython and then py2exe to create a standalone exe that can run on any machine without requiring python to be installed
The following tutorial shows everything step by step: Quickly Creating Professional
Looking Application Using wxPython, py2exe and InnoSetup
I would recommend that you use IronPython, which is Microsoft's implementation of Python for the .NET framework.
Tkinter is quick and easy to use. Tkinter is in the Python standard library.