HOWTO · Tkinter

How to Install Tkinter

In this tutorial we demonstrate how to install Tkinter on multiple platforms. Every platform has individual commands to install Tkinter in Python.

On this page

Tkinter is Python’s standard library interface to the Tk GUI toolkit, so it is not a package pip can install: the tk package that pip install tk downloads is an unrelated project and does not provide the module. Whether you already have Tkinter depends on how your Python was installed — the python.org installers bundle the Tcl/Tk libraries it needs, while Linux distributions package that support separately from the interpreter. Start by checking the interpreter you actually run:

python -c "import tkinter; print(tkinter.TkVersion)"

If it prints a version number such as 8.6, Tkinter is available and there is nothing to install. If it fails with ModuleNotFoundError: No module named 'tkinter', follow the section for your platform below, then run the same check again in the same interpreter.

Install Tkinter on Windows

The python.org installer for Windows ships the Tcl/Tk support Tkinter needs. During setup it appears as the tcl/tk and IDLE option — IDLE, the editor bundled with the installer, is itself a Tkinter application — and the option is selected in a standard installation, so a python.org interpreter normally passes the check above.

If the check fails in an existing installation, the support was left out during setup. Re-run the installer for your Python version (or use the Modify option for the existing installation) and make sure tcl/tk and IDLE is selected; there is no separate Tkinter download for Windows, and no pip command that adds it.

Anaconda and Miniconda environments are self-contained: their Python builds include the Tk libraries, so Tkinter normally imports in a conda environment without extra steps. In a minimal environment where the import fails, add the libraries with conda install tk inside that environment, then re-run the check with that environment’s interpreter.

Install Tkinter on Linux

Linux distributions split Tkinter out of the interpreter package, so on Linux installing Tkinter means installing one distribution package. The package name differs by distribution family — use the command for yours.

On Debian, Ubuntu, and derivatives, the package is python3-tk (Debian’s package description states that the Tkinter module is broken out of the standard library into this package):

sudo apt install python3-tk

On Fedora, the package is python3-tkinter:

sudo dnf install python3-tkinter

On Arch Linux, pacman is the package manager and the Tk toolkit itself is the tk package — installing it gives the system Python the libraries its Tkinter module loads:

sudo pacman -S tk

These commands apply to the distribution’s Python 3; if you run a specific interpreter version, install the matching versioned package your distribution offers (for example python3.13-tk on Debian/Ubuntu or python3.13-tkinter on Fedora). Anything written for Python 2 describes an obsolete interpreter line and does not apply, and downloading a source tarball of an unrelated tk package and running its setup script is not an installation route for the standard library module.

Install Tkinter on macOS

The python.org installer for macOS bundles its own Tcl/Tk, so an interpreter installed from python.org includes Tkinter — run the check with that interpreter to confirm.

Homebrew’s Python is different: Homebrew states in its formula caveats that tkinter is no longer included with the python formula and is available separately. Install it with:

brew install python-tk

The python-tk formula tracks the current Homebrew Python; if you run a versioned Homebrew Python such as python@3.13, install the matching python-tk@3.13 so the module lands in the interpreter that needs it. As on Windows, pip cannot supply the standard library module.

Install Tkinter in PyCharm

PyCharm does not provide Tkinter, and there is nothing to install inside the IDE for it: Tkinter belongs to the Python interpreter the project is configured to use. If a project reports that tkinter is missing, the configured interpreter is one without Tk support.

Open the project’s interpreter settings and run the check from the top of this article against that interpreter — PyCharm’s Python console for the project uses the same environment. If it fails, fix the interpreter rather than the project: install the platform package from the sections above for a system interpreter, or select an interpreter that passes the check, such as the python.org interpreter on Windows or macOS or a conda environment. Adding a package literally named tk through PyCharm’s package tool installs the unrelated PyPI package and does not fix the import.

Whichever platform you are on, finish by verifying in the interpreter your code will actually run with. Python ships a built-in Tkinter demonstration that doubles as the verification:

python -m tkinter

Run with the interpreter you checked, it opens a small window reporting the Tcl/Tk version when Tkinter is correctly installed; close the window to end it. If the import check prints a Tk version and this window opens, your environment has everything Tkinter needs.