How to Install Tkinter on Linux?
Tkinter is the most popular Python library used to create GUI-based applications. The name Tkinter comes from the Tk interface. In this article, we will look into the process of installing Tkinter in a Linux system.
Note: Tkinter module comes in bundled with Python, so this article can be helpful for those who might face an error running Tkinter on their system.
Follow the below step to install Tkinter on a Linux system:
Step 1. Open up the Linux terminal and run the following command depending upon your version of Linux:
For Debian-based Linux:
sudo apt-get install python-tk
For Arch-based Linux:
sudo pacman -S tk
For Fedora-based Linux:
sudo dnf install python3-tkinter
For RHEL, CentOS, Oracle Linux:
sudo yum install -y tkinter tk-devel
Step 2: After writing the above command hit the enter button and type your user password. After this, it will ask you to confirm the installation type “Y” in the terminal and hit enter.
Step 3: To verify the Tkinter installation run the following command in the terminal. And you will see a pop-up window opened with two buttons showing the current version of Tkinter installed.
python -m Tkinter
Note: The highlighted text shows the current version of the Tkinter i.e. 8.6