I'm trying to convert a fairly simple Python program to an executable and couldn't find what I was looking for, so I have a few questions (I'm running Python 3.6):
The methods of doing this that I have found so far are as follows
pyinstaller/py2exe
Here is what I've tried/what problems I've run into.
pyinstaller
before the required download before it (pypi-something) so it did not work. After downloading the prerequisite file, pyinstaller
still does not recognize it.Steps to convert .py to .exe in Python 3.6
pip install cx_Freeze
.pip install idna
..py
program named myfirstprog.py
.setup.py
on the current directory of your script.setup.py
file, copy the code below and save it.python setup.py build
build
. It has another folder in it. Within that folder you can find your application. Run it. Make yourself happy.See the original script in my blog.
setup.py:
from cx_Freeze import setup, Executable
base = None
executables = [Executable("myfirstprog.py", base=base)]
packages = ["idna"]
options = {
'build_exe': {
'packages':packages,
},
}
setup(
name = "<any name>",
options = options,
version = "<any number>",
description = '<any description>',
executables = executables
)
EDIT:
myfirstprog.py
you should put your .py
extension file name as created in step 4;import
ed package in your .py
into packages
list (ex: packages = ["idna", "os","sys"]
)any name, any number, any description
in setup.py
file should not remain the same, you should change it accordingly (ex:name = "<first_ever>", version = "0.11", description = ''
)import
ed packages must be installed before you start step 8.