Feb-26-2020, 07:24 PM
I'm currently attempting to take one of my projects and turn it into a .exe file with cxfreeze. Unfortunately I've run into a problem I just cant seem to figure out, I'm hoping maybe someone can tell me what I'm doing wrong here?
So here's the thing...
I use "python setup.py" to initialize the building of the new file. Everything goes through, no issues so far...
When the whole process is done I navigate to the "build" file which gets written to the venv folder and inside that folder lies the new .exe file.
Here's the confusing part.
When I launch it i get the following error.
Traceback (most recent call last):
File
"C:\users\owner\desktop\untitled\venv\lib\site-packages\cx_freeze\initscripts\console.py"
Line 37, in run exec(code, {__name__':'__main__})
File "Structured map.py" line 3, in <module>
ModuleNotFoundError: No module named 'tkinter'
Why is it not finding the tkinter module? I can run the "structured map" file just fine with tkinter imported and it will find it, I have also checked stack overflow and done quite a bit of research but can't find any solution.
Any help is appreciated :)
So here's the thing...
import sys from cx_Freeze import setup, Executable # Dependencies are automatically detected, but it might need fine tuning. build_exe_options = {"packages": ["os"], "excludes": ["tkinter"]} # GUI applications require a different base on Windows (the default is for a # console application). base = None if sys.platform == "win32": base = "Win32GUI" setup( name = "testproject1", version = "0.1", description = "My GUI application!", options = {"build_exe": build_exe_options}, executables = [Executable("Structured map.py", base=base)])This is my setup file that I use to start the whole process. Both this file and my project lies in the root venv folder which also contains the actual python installation and all modules I have ever used.
I use "python setup.py" to initialize the building of the new file. Everything goes through, no issues so far...
When the whole process is done I navigate to the "build" file which gets written to the venv folder and inside that folder lies the new .exe file.
Here's the confusing part.
When I launch it i get the following error.
Traceback (most recent call last):
File
"C:\users\owner\desktop\untitled\venv\lib\site-packages\cx_freeze\initscripts\console.py"
Line 37, in run exec(code, {__name__':'__main__})
File "Structured map.py" line 3, in <module>
ModuleNotFoundError: No module named 'tkinter'
Why is it not finding the tkinter module? I can run the "structured map" file just fine with tkinter imported and it will find it, I have also checked stack overflow and done quite a bit of research but can't find any solution.
Any help is appreciated :)