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)