I am trying to create a windows executable (.exe) with python3.7.6 cx_freeze. I have removed my username and python script name from the following code.
#!/usr/bin/env python3
import sys, os
from cx_Freeze import setup, Executable
PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
os.environ["TCL_LIBRARY"] = os.path.join(PYTHON_INSTALL_DIR, r"tcl", r"tcl8.6")
os.environ["TK_LIBRARY"] = os.path.join(PYTHON_INSTALL_DIR, r"tcl", r"tk8.6")
#includes = []
include_files = [r'C:\Users\<username>\AppData\Local\Programs\Python\Python37\DLLs\tcl86t.dll',
r'C:\Users\<username>\AppData\Local\Programs\Python\Python37\DLLs\tk86t.dll']
build_options = {"packages": ["os","pandas","numpy","openpyxl","re","sys","easygui","pyexcel",
"string", "utils","tkinter",
r'C:\\Users\\<username>\\AppData\\Local\\Programs\\Python\\Python37\\lib\\tkinter'],"includes":
[r'C:\\Users\\<username>\\AppData\\Local\\Programs\\Python\\Python37\\lib\\tkinter'], 'include_files':
include_files}
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup(name="Extract from <script_name>",version="1.0",options ={'build_exe':
build_options},description="Extracts information from <script_name>",executables=
[Executable("<script_name>", base = base)])
I am prompted with these errors after building:
The setup.py script is based on:
cx_freeze Tkinter 'Module not Found'
How to include tkinter when using cx_freeze to convert script to .exe?
I have tried building with/without specifying the modules both in includes/package options, providing tkinter .dll files, and tkinter absolute package path.
I also checked the cx_freeze documentation:
https://cx-freeze.readthedocs.io/en/latest/index.html
In the frequently asked questions, it mentions the following:
"Modules that your code imports are detected, but if they’re dynamically loaded - e.g. by a plugin system - you have to tell cx_Freeze about them."
If this is the case and cause of the issue, how would I go about identifying dynamically loaded packages?
Any help in resolving this would be appreciated.
Thanks again,
enzsio