I created a small converter and after building it with CX_Freeze it shows this error
Traceback (most recent call last): File "C:\users\LDC\AppData\Local\Programs\python\python36-32\lib\sitr\e-packages\cx_freeze\initscripts_startup_.py", line14 in run module.run() File "C:\users\LDC\AppData\Local\Programs\python\python36-32\lib\sitr\e-packages\cx_freeze\initscripts\console.py", line26 in run exec(code,m.dict) File"GUI1.py",line 1, in File "C:\USERS\LDC\APPDATA\LOCAL\PROGRAMS\PYTHON\PYTHON36-32\LIB\TKINTER_INIT_.PY",line36,in import_tkinter#If this fails your python may not be configured for Tk ImportError: DLL load failed: the specified module could not be found
This is a screen shot from the error
Now this is my code:
from tkinter import *
window1=Tk()
def convert():
var2=var1.get()
var3=var2*3.785
e2.insert(0,var3)
def clear():
e1.delete(0,END)
e2.delete(0,END)
def quit():
window1.destroy()
var1=IntVar()
label1=Label(window1,text='Gallons',padx=25).grid(row=0,sticky=W)
e1=Entry(window1,width=25,textvariable=var1)
e1.grid(row=0,column=1)
label2=Label(window1,text='Liters',padx=25).grid(row=1,sticky=W)
e2=Entry(window1,width=25)
e2.grid(row=1,column=1)
window1.title("Converter")
window1.geometry("400x200+200+200")
button1= Button(text='convert',command=convert,width=15,).grid(row=4,column=0)
button2= Button(text='clear',command=clear,width=15).grid(row=4,column=1)
button3= Button(text='exit',command=quit,width=15).grid(row=5,column=1)
mymenu=Menu()
mymenu.add_cascade(label='File')
mymenu.add_cascade(label='Edit')
mymenu.add_cascade(label='View')
mymenu.add_cascade(label='Tools')
mymenu.add_cascade(label='Help')
window1.config(menu=mymenu)
window1.mainloop()
and this is the setup code
import cx_Freeze
import sys
import os.path
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')
base = None
if sys.platform == 'win32':
base = "Win32GUI"
executables = [cx_Freeze.Executable("GUI1.py", base=base, icon="clienticon.ico")]
cx_Freeze.setup(
name = "GUI1",
options = {"build_exe": {"packages":["tkinter"], "include_files":["clienticon.ico"]}},
version = "0.01",
description = "Ya Rb",
executables = executables
)
I tried the following with no luck: 1. uninstalled cx freeze and installed it again 2. tried different version of python .. python 2.7 3. tried to use py2exe and pyinstaller got different errors 4. also made sure that the python path in the environment is set correctly
Thanks in advance appreciate your help..