DEV Community

Cover image for How to Fix Missing Tkinter Library Error When Creating Executable in Tkinter
Jose Latines
Jose Latines

Posted on

How to Fix Missing Tkinter Library Error When Creating Executable in Tkinter

πŸ€” Have you ever encountered an error when creating an executable of your Tkinter app?

πŸ‘¨β€πŸ’» I faced a similar issue where some windows were not showing up. After some investigation, I discovered that the problem was due to the absence of the Tkinter library in the executable file.

πŸ‘ Luckily, the solution was simple. By running the command pyinstaller --onefile --hidden-import tkinter hello.py when creating the executable, I was able to include the missing library and resolve the issue. Hope this tip helps fellow Tkinter developers out there!

Options

πŸ“ --onefile is to just creating a .exe file
πŸ” --hidden-import <library> is for import the libray
πŸ™ˆ -w is for not showing the console when the executable runs

Top comments (0)