Last modified: May 28, 2025 By Alexander Williams

How to Install Tkinter in Python

Tkinter is Python's standard GUI library. It helps create desktop apps easily. This guide shows how to install Tkinter.

What Is Tkinter?

Tkinter is a built-in Python module for GUI development. It uses the Tk GUI toolkit. It is simple and works on all major platforms.

Check If Tkinter Is Installed

Python often comes with Tkinter pre-installed. Check if it's installed by running this command:


import tkinter as tk
print(tk.TkVersion)


8.6

If you see a version number, Tkinter is installed. If not, follow the steps below.

Install Tkinter on Windows

On Windows, Tkinter is usually included with Python. If not, install it using pip:


pip install tk

After installation, verify it works by running the check command again.

Install Tkinter on macOS

macOS users may need to install Tkinter separately. Use Homebrew for easy installation:


brew install python-tk

If you face issues, ensure you have the latest Python version.

Install Tkinter on Linux

On Linux, use the package manager to install Tkinter. For Debian/Ubuntu, run:


sudo apt-get install python3-tk

For Fedora, use:


sudo dnf install python3-tkinter

Basic Tkinter Example

Test your Tkinter installation with a simple GUI app. Here's a basic example:


import tkinter as tk

root = tk.Tk()
root.title("Tkinter Test")
label = tk.Label(root, text="Hello, Tkinter!")
label.pack()
root.mainloop()

This code creates a window with a label. Run it to see if Tkinter works.

Common Issues and Fixes

If Tkinter is not found, reinstall Python with Tkinter support. On Linux, ensure dependencies are installed.

For other Python libraries, check guides like How to Install PyAudio in Python Easily or How to Install wxPython in Python.

Conclusion

Tkinter is a powerful tool for GUI development in Python. Installing it is simple on all platforms. Follow this guide to get started quickly.

For more Python libraries, explore Install PyWin32 in Python Easily.