How to install Tkinter for Python on Linux?


Tkinter is one of the widely used libraries for creating GUI-based applications. In order to create applications using Tkinter, we have to install and import the library in the notebook.

First, we have to install the tkinter library in our local environment based on the Windows or Linux operating system.

For Windows users −

pip install tkinter

or

pip install tk

For Linux or Mac users −

apt-get install python-tk

Once installed, the user can import the tkinter library in the notebook using the following command,

from tkinter import*

To check if tkinter is installed in the system or not, we can use the following command,

import tkinter as tk

Updated on: 26-Mar-2021

12K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements