Install Tkinter on Ubuntu Linux
Install Tkinter on Ubuntu and other Debian-based Linux distributions

Heads up! You've already completed this tutorial.

Before you start the Tkinter tutorial you will need to have a working installation of PyQt5 on your system. If you don't have either set up yet, the following steps will guide you through how to do this on Linux.

This guide is also available for macOS. On Windows, Tkinter is installed by default with Python.

Table of Contents

Install Tkinter via apt

Packages for Tkinter are available in the repositories of most distributions. In Ubuntu you can install either from the command line or via "Software Center". The package you are looking for is named python3-tk.

You can also install these from the command line as follows --

bash
sudo apt install python3-tk

After install is finished, you should be able to run python3 (or python) and import tkinter without errors.

python
Python 3.7.6
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>>

You can now start creating Python GUI applications with Tkinter.

The complete guide to packaging Python GUI applications with PyInstaller.
[[ discount.discount_pc ]]% OFF for the next [[ discount.duration ]] [[discount.description ]] with the code [[ discount.coupon_code ]]

Purchasing Power Parity

Developers in [[ country ]] get [[ discount.discount_pc ]]% OFF on all books & courses with code [[ discount.coupon_code ]]
Well done, you've finished this tutorial! Mark As Complete
[[ user.completed.length ]] completed [[ user.streak+1 ]] day streak

Install Tkinter on Ubuntu Linux was written by Martin Fitzpatrick .

Martin Fitzpatrick has been developing Python/Qt apps for 8 years. Building desktop applications to make data-analysis tools more user-friendly, Python was the obvious choice. Starting with Tk, later moving to wxWidgets and finally adopting PyQt.