Cx_Freeze Crashing Python 3.7.0

How do I fix an Error when Freezing Python 3.7 Script using cx_Freeze

Instructions for making .EXE files from programs using PySimpleGUI can be found in the docs here.

To create the .EXE:

pyinstaller -wF yoursourcefile.py

I would upgrade your PySimpleGUI package prior to doing it.

Understanding the fix for the known bug: cx_Freeze & Python 3.7

To find the path to the freezer.py file you need to modify, run the following in a Python console:

from cx_Freeze import freezer
print(freezer.__file__)

Modify then this file according to this commit of the cx_Freeze repository, which means remove the red lines annotated with - and add the green lines annotated with +.

Can't install cx_Freeze or scipy for Python 3.7 64-bit

You could manage to install it from wheel.

First you need to install wheel:

pip install wheel

Then go to the following link to download the cx_Freeze wheel file according to you python version and windows version:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#cx_freeze

For 64bit and Python 3.7: cx_Freeze‑5.1.1‑cp37‑cp37m‑win_amd64.whl

On your command prompt change directory to the downloaded folder and use the command:

pip install cx_Freeze‑5.1.1‑cp37‑cp37m‑win_amd64.whl 

For further description on installing from wheel, check the following link: https://pip.pypa.io/en/latest/user_guide/#installing-from-wheels

The same method will solve your problem to install scipy.

tkinter program compiles with cx_Freeze but program will not launch

Try to modify you setup.py as follows:

import sys
from cx_Freeze import setup, Executable

import os
PYTHON_INSTALL_DIR = os.path.dirname(sys.executable)
os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')
os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6')

include_files = [(os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tk86t.dll'), os.path.join('lib', 'tk86t.dll')),
(os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tcl86t.dll'), os.path.join('lib', 'tcl86t.dll'))]

base = None
if sys.platform == 'win32':
base = 'Win32GUI'

executables = [Executable('SimpleTkApp.py', base=base)]

setup(name='simple_Tkinter',
version='0.1',
description='Sample cx_Freeze Tkinter script',
options={'build_exe': {'include_files': include_files}},
executables=executables)

This should work for cx_Freeze version 5.1.1 (the current version). In this version, the included modules are in a subdirectory lib of the build directory. If you use 5.0.1 or an earlier version, set

include_files = [os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tk86t.dll'),
os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tcl86t.dll')]

instead.

See also 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 and python tkinter exe built with cx_Freeze for windows won't show GUI

EDIT:

A further problem is that cx_Freeze has a bug with python 3.7 which is not yet corrected. See Cx_freeze crashing Python3.7.0 . You can find there a link to a bug fix which you should apply manually (according to the OP this solved the problem, see comments).



Related Topics



Leave a reply



Submit