This is a template repository code for converting Python script to Windows executable using the cx_freeze library
pip install cx_Freeze
First, place the setup.py file in the same folder where your main Python file is. After that, Place the name of the Python file under the "executables" variable and include any additional files under the "options" variable. Then, set the process's name, add a description, and save the changes.
Now, open the terminal in the folder and run this command
python setup.py build
This will compile the program under the "build" folder.
Change the executables line to this:
executables = [Executable("python_file_name.py", base=base, icon="favicon.ico")]
After that, add the same "favicon.ico" in the same line as "include_files" so that it is like
"include_files": ["favicon.ico"],
Make sure to keep the icon file within the same folder too. Then run the build command, and the program will include the program icon.