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’, … Read more

Use cx-freeze to create an msi that adds a shortcut to the desktop

To create a shortcut to the application, give the shortcut_name and shortcut_dir options to the Executable. The shortcut_dir can name any of the System Folder Properties (thanks Aaron). For example: from cx_Freeze import * setup( executables = [ Executable( “MyApp.py”, shortcut_name=”DTI Playlist”, shortcut_dir=”DesktopFolder”, ) ] ) You can also add items to the MSI Shortcut … Read more

Minimal set of files required to distribute an embed-Cython-compiled code and make it work on any machine

After further research (I tried in an empty Win 7 x64 bit VM, without any VCredist previously installed), it seems that these files are enough: the program itself, test.exe (produced by cython –embed and compilation with cl.exe) python37.dll python37.zip coming from packages named “Windows x86-64 embeddable zip file” in https://www.python.org/downloads/windows/ vcruntime140.dll, as mentioned in Can … Read more

How can I bundle other files when using cx_freeze?

Figured it out. from cx_Freeze import setup,Executable includefiles = [‘README.txt’, ‘CHANGELOG.txt’, ‘helpers\uncompress\unRAR.exe’, , ‘helpers\uncompress\unzip.exe’] includes = [] excludes = [‘Tkinter’] packages = [‘do’,’khh’] setup( name=”myapp”, version = ‘0.1’, description = ‘A general enhancement utility’, author=”lenin”, author_email=”le…@null.com”, options = {‘build_exe’: {‘includes’:includes,’excludes’:excludes,’packages’:packages,’include_files’:includefiles}}, executables = [Executable(‘janitor.py’)] ) Note: include_files must contain “only” relative paths to the setup.py script … Read more

KeyError: ‘TCL_Library’ when I use cx_Freeze

You can work around this error by setting the environment variables manually: set TCL_LIBRARY=C:\Program Files\Python35-32\tcl\tcl8.6 set TK_LIBRARY=C:\Program Files\Python35-32\tcl\tk8.6 You can also do that in the setup.py script: os.environ[‘TCL_LIBRARY’] = r’C:\Program Files\Python35-32\tcl\tcl8.6′ os.environ[‘TK_LIBRARY’] = r’C:\Program Files\Python35-32\tcl\tk8.6′ setup([..]) But I found that actually running the program doesn’t work. On the cx_freeze mailinglist it was mentioned: I have … Read more