I am using cx_freeze to transfer a python file to a exe. the problem is when i exclude tkinter in the setup.py, i can generate the exe file successfully, but when execute th
You have to make two modifications to your setup.py to get things working:
Set TCL-LIBRARY and TK_LIBRARY environment variables. (You already did this)
Add the tcl86t.dll and tk86t.dll to your include_files parameter
So the setup.py should look something like this:
import os
from cx_Freeze import setup, Executable
os.environ['TCL_LIBRARY'] = 'c:/python36/tcl/tcl8.6'
os.environ['TK_LIBRARY'] = 'c:/python36/tcl/tk8.6'
# Dependencies are automatically detected, but it might need
# fine tuning.
buildOptions = dict(
packages = [],
excludes = [],
include_files=['c:/python36/DLLs/tcl86t.dll', 'c:/python36/DLLs/tk86t.dll']
)
import sys
base = 'Win32GUI' if sys.platform=='win32' else None
executables = [
Executable('editor.py', base=base)
]
setup(name='editor',
version = '1.0',
description = '',
options = dict(build_exe = buildOptions),
executables = executables)