How to Install TKinter on PyCharm?

Tkinter is a Python library that allows you to write GUI interfaces for Windows, Unix, and Linux operating systems.

Problem Formulation: Given a PyCharm project. How to install the Tkinter library in your project within a virtual environment or globally?

The Tkinter library is built-in with every Python installation, so it’s already installed in PyCharm per default. This means that you have to do nothing else but to run “import tkinter” or “import tkinter as tk” in your Python 3 script without installation.

import tkinter
Install Tkinter Python PyCharm

(Just ignore the AttributeError in the console—I tried to check the TKinter version but it didn’t have the __version__ attribute. 😅 )

If just importing the Tkinter library doesn’t work for you, chances are that you’re using Python 2 in which case you may want to try the capitalized form “import Tkinter” like so:

import Tkinter

Of course, you can also try to manually install Tkinter in the PyCharm “Terminal” view using either of the following:

  • pip install python-tk
  • pip install python3-tk
  • sudo apt-get install python-tk
  • sudo apt-get install python3-tk

Feel free to check out the following free email academy with Python cheat sheets to boost your coding skills!

To become a PyCharm master, check out our full course on the Finxter Computer Science Academy available for free for all Finxter Premium Members: