I am trying to convert a .py file to .exe using cx_Freeze 5.1.1., but an ImportError: DLL load failed
pops up every time I try to run the file. Based on the suggested solutions here and here, I added tcl86t.dll and tk86t.dll to the list of included files. They appear in the build folder, but the error message keeps popping up.
Here is my setup.py:
import sys
import os
from cx_Freeze import setup, Executable
os.environ["TCL_LIBRARY"] = r"C:/Users/Name/AppData/Local/Programs/Python/Python36-32/tcl/tcl8.6"
os.environ["TK_LIBRARY"] = r"C:/Users/Name/AppData/Local/Programs/Python/Python36-32/tcl/tk8.6"
base = "Win32GUI" if sys.platform=="win32" else None
build_exe_options = {"packages": ["winsound", "random", "time", "tkinter", "math"],
"include_files": ['tcl86t.dll',
'tk86t.dll']}
setup(
name = "Game",
author = "Name",
description = "game description",
options = {"build_exe": build_exe_options},
executables = [Executable("game.py", base=base)]
)
I'm using Python 3.6.3 and Windows 10. Any help would be greatly appreciated!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…