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):
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 = "",
options = options,
version = "",
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 = "", version = "0.11", description = ''
)import
ed packages must be installed before you start step 8.