Reputation: 1680
I am using Python 2.7
I am looking for the best way to make an .exe with my program. My program is a application development tool that generates a .py file. What is the best way to convert this .py file to an .exe?
The conversion will take place on the users computer and they may not have python installed.
-Thanks
Upvotes: 1
Views: 179
Reputation: 7257
I have been using PyInstaller for the past year or so and have really come to like it. Below I have a few of the key features that pulled me from py2exe to pyinstaller
It does not need to be installed (ie no python setup.py install
) to use it. It's designed to be called from within a directory.
Executables can be built with a single command ie: python pyinstaller.py -F -o publish -n MyExeName my_handy_script.py
The latest version does not require the 'MSVCP90.dll' (or similar) library to be distributed. See this SO post regarding some of the headaches associated with this library.
Pyinstaller seems to create smaller single file executables.
Pyinstaller works on Linux, Windows, and Mac
Actively being developed (py2exe last updated nearly 4 years ago)
Upvotes: 2
Reputation: 12174
You can use py2exe but only if python is installed on the computer. There is no way to do the conversion without having python installed.
Upvotes: 0
Reputation: 65599
The best way is to use py2exe with distutils. Here's a sample setup.py from a project I have on github:
from distutils.core import setup
import py2exe
from version import version
# This is a GUI app, so I set the windows variable
# I include in with the exe a single data file -- LICENSE.text
# I then set a bunch of options specific to py2exe
setup(windows=[{'script':'mainWindow.py', 'dest_base':'VisPerf'}],
data_files = ['../LICENSE.txt'],
options = {
'py2exe': {
'dist_dir':("../bin/32/%s" % version),
'dll_excludes': [
'MSVCP90.dll'
],
'optimize' : 2
}
})
Then from the command line:
C:\YourDirHere\>python setup.py py2exe
Upvotes: 2
Reputation: 4522
py2exe (and its py2app
MacOSX counterpart) are commonly used for this. I have used py2app
, and can say that I am pleased with it. I would assume that py2exe
is also quick and easy.
Upvotes: 0