I wrote a basic program to keep track of customer names, vehicles, mileage, and date, and it also has an option for the user to choose to see a company logo that I drew using the turtle module. Then I used cx_freeze to freeze it as an executable, and everything froze and a build file with all the necessary files and folders and an executable was created, but when I run the .exe file I can't choose my option to view the company logo. I continue to get this error when running it in CMD:
C:\Users\hdaug\Documents\Holden's Personal\PythonPrograms\CX\build\exe.win-amd64-3.6>OilChangeEx.exe
At Holden's Oil Change we use our custom built Python program to keep track of customer records and to display our company logo!!
Select and option from the menu!
1 Current Customers
2 New Customers
3 Company Logo
4 Quit
Select an option: 3
Traceback (most recent call last):
File "C:\Program Files\Python36\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 14, in run
module.run()
File "C:\Program Files\Python36\lib\site-packages\cx_Freeze\initscripts\Console.py", line 26, in run
exec(code, m.__dict__)
File "OilChangeEx.py", line 282, in <module>
File "OilChangeEx.py", line 56, in main
File "OilChangeEx.py", line 77, in commandChoice
File "OilChangeEx.py", line 176, in Turt
File "C:\Program Files\Python36\lib\turtle.py", line 107, in <module>
import tkinter as TK
File "C:\Program Files\Python36\lib\tkinter\__init__.py", line 36, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ImportError: DLL load failed: The specified module could not be found.
The top part of the error is the actual running of my code and you can see the 4 options; all of these work other than #3.
I have checked in the tkinter documentation and the cx_Freeze documentation and cannot find anything that I am doing wrong. Here is my setup.py file that I am using to build my executable:
from cx_Freeze import setup, Executable
import os
os.environ['TCL_LIBRARY'] = r'C:\Program Files\Python36\tcl\tcl8.6'
os.environ['TK_LIBRARY'] = r'C:\Program Files\Python36\tcl\tk8.6'
build_exe_options = {"includes": ["turtle","_tkinter"]}
setup(name='OilChange',
version='0.1',
description='OilChangeRecords',
options = {"build_exe": build_exe_options},
executables = [Executable('OilChangeEx.py')])
The tkinter module in the "includes" for my build_exe, I have tried to remove and spell it just tkinter, I have tried to put both tkinter and turtle, and each individual module in "packages" instead of "includes". I have tried every option that relates to my situation in the cx_Freeze documentation with no luck.
I found another question that closely relates to mine: import _tkinter # If this fails your Python may not be configured for Tk There are no answers to this question and mine somewhat differs.
I am running Windows 10 OS and Python 3.6.1 Also the script does work when ran from the Python IDLE