Reputation: 76
i have a program in python that i'd like to turn to .exe using cx_Freeze, but it gives an error, follow the image: Here's the image
Here's my setup.py code
import sys
from cx_Freeze import setup,Executable
import os.path
from tkinter import *
os.environ['TCL_LIBRARY'] = r'C:\Program Files\Python36\tcl\tcl8.6'
os.environ['TK_LIBRARY'] = r'C:\Program Files\Python36\tcl\tk8.6'
PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
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')
options = {
'build_exe': {
'include_files':[
os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tk86t.dll'),
os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tcl86t.dll'),
],
},
}
base=None
if sys.platform=='win32':
base='Win32GUI'
executables=[
Executable('TABUADATKINTER.py',base=base)
]
buildOptions=dict(
packages=[],
includes=['pygame'],
include_files=[],
excludes=[]
)
setup(
name='Tabuada',
version='1.0',
description='TABUADA',
options=dict(build_exe=buildOptions),
executables=executables
)
Tell me if the code of my program is needed, please help me, i don't know how to solve this.
Upvotes: 1
Views: 102
Reputation: 369
Give this a try:
from cx_Freeze import setup,Executable
import os.path
from tkinter import *
PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
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')
packages = ["pygame"]
options = {
'build_exe': {
'include_files':[
os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tk86t.dll'),
os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tcl86t.dll'),
],
'packages':packages,
},
}
base=None
if sys.platform=='win32':
base='Win32GUI'
executables=[Executable('TABUADATKINTER.py',base=base)]
setup(
name = 'Tabuada',
options = options,
version = "1.0",
description = 'TABUADA',
executables = executables
)
Upvotes: 1