Skip to content

Instantly share code, notes, and snippets.

@tashirka1
Forked from Deusdies/setup.py
Created April 16, 2018 07:32
Show Gist options
  • Save tashirka1/7a233cdab855abbc4060a1c731b09d93 to your computer and use it in GitHub Desktop.
Save tashirka1/7a233cdab855abbc4060a1c731b09d93 to your computer and use it in GitHub Desktop.
Creating an executable file with Python 3.6, cx_Freeze
"""
== SETUP.PY FILE FOR USE WITH CX_FREEZE AND PYTHON 3.6 ==
==== INSTRUCTIONS ====
1. Make sure you have Python 3.6 installed.
2. Install cx_Freeze by typing `pip install cx_freeze` in the Terminal or Command Prompt. Make sure to use the pip for Python 3 (sometimes called pip3)
3. Create a new file called setup.py and paste the contents of this file in it (or just download this file)
4. Make sure to place the setup.py file in the same directory where your main Python application is located
5. From the Terminal/Command Prompt, run `python setup.py build`. Make sure that you're running Python 3.6 (use `python --version`)
6. Enjoy!
The script should have created another folder called `build/`. You will find your generated .exe file.
"""
from cx_Freeze import setup, Executable
base = None
executables = [Executable("YOUR_FILE_NAME.py", base=base)]
packages = ["idna"]
options = {
'build_exe': {
'packages':packages,
},
}
setup(
name = "YOUR_PROGRAM_NAME",
options = options,
version = "VERSION_NUMBER e.g. 0.1",
description = 'YOUR_PROGRAM_DESCRIPTION',
executables = executables
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment