Skip to content

Instantly share code, notes, and snippets.

@Deusdies
Last active July 28, 2020 15:05
Show Gist options
  • Save Deusdies/f84fb84eb2cb512870e6af5059fa3c7b to your computer and use it in GitHub Desktop.
Save Deusdies/f84fb84eb2cb512870e6af5059fa3c7b 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
)
@Divyanbhard29
Copy link

I already make exe file but there is problem , that file is not installing .

@CrispenGari
Copy link

Ive made an executable file and that file is not installing and secondly it does't accept the icon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment