Getting “ImportError: DLL load failed: The specified module could not be found” when using cx_Freeze even with tcl86t.dll and tk86t.dll added in

In cx_Freeze version 5.1.1, the included modules are in a subdirectory lib of the build directory. The tcl86t.dll and tk86t.dll DLLs apparently need to be moved there as well.

You can do this with the following modification of your setup.py script:

build_exe_options = {"packages": ["winsound", "random", "time", "tkinter", "math"],
                     "include_files": [('tcl86t.dll', os.path.join('lib', 'tcl86t.dll')),
                                       ('tk86t.dll', os.path.join('lib', 'tk86t.dll'))]}

Leave a Comment