Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I convert a Python program to a runnable .exe Windows program? [duplicate]

Tags:

python

exe

I am looking for a way to convert a Python Program to a .exe file WITHOUT using py2exe. py2exe says it requires Python 2.6, which is outdated. Is there a way this is possible so I can distribute my Python program without the end-user having to install Python?

like image 722
bolharr2250 Avatar asked May 15 '12 01:05

bolharr2250


People also ask

What tool can convert Python script to Windows executable?

You can just type pip install pyinstaller to install it and pyinstaller -w yourpythonscript.py to compile it to an exe.

Can you compile Python into exe?

Yes, it is possible to compile Python scripts into standalone executables. PyInstaller can be used to convert Python programs into stand-alone executables, under Windows, Linux, Mac OS X, FreeBSD, Solaris, and AIX. It is one of the recommended converters.

How do I convert Python code to App?

To convert the Python code into an executable file, we will be using Pyinstaller package. Use the standard 'pip install' command to install this package.


2 Answers

Understand that every 'freezing' application for Python will not really secure your code in any way. Every packaging system for a stand-alone executable Python 'program' will include a lot of the Python libraries and interpreter, which will make your program pretty large.

That said, PyInstaller has done a nearly flawless job with everything I've thrown at it. Currently it only supports up to Python 2.7 but Pyinstaller's support for a varied set of libraries large and small is unmatched in other 'freeze' type programs for Python.

like image 78
PenguinCoder Avatar answered Sep 22 '22 06:09

PenguinCoder


I use cx_Freeze. Works with Python 2 and 3, and I have tested it to work on Windows, Mac, and Linux.

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

like image 22
Omega Goggles Avatar answered Sep 23 '22 06:09

Omega Goggles