how to install tkinter with Pycharm?
Solution 1
Make sure you use the right import statement for your version of Python.
Python 2.7
from Tkinter import *
For Python 3.x
from tkinter import *
Solution 2
For python 2
use:
sudo apt-get install python-tk
For python 3
use:
sudo apt-get install python3-tk
When you display info about packages it states:
Tkinter - Writing Tk applications with Python2 (or Python 3.x)
But my assumption is that PyCharm created it's own virtualenv for you project, so you are probably using wrong python interpreter in PyCharm.
Open your PyCharm project. Go to File->Settings->Project->Project Interpreter
. At top, you will see what python interpreter is PyCharm using for a current project. If that's not the system one you have, find path to system interpreter and add it to Python Interpreters
in PyCharm.
More details on PyCharm Documentation.
TheProgramMAN123
Updated on September 19, 2021Comments
-
TheProgramMAN123 almost 3 years
I used
sudo apt-get install python3.6-tk
and it works fine. Tkinter works if I open python in terminal, but I cannot get it installed on my Pycharm project.pip install
command says it cannot find Tkinter. I cannot find python-tk in the list of possible installs either.Is there a way to get Tkinter just standard into every virtualenv when I make a new project in Pycharm?
Edit: on Linux Mint
Edit2: It is a clear problem of Pycharm not getting tkinter guys. If I run my local python file from terminal it works fine. Just that for some reason Pycharm cannot find anything tkinter related.
-
TheProgramMAN123 over 5 yearsThen why do I get the error ModuleNotFoundErr: No modlue named 'Tkinter' when I try to use matplotlib
-
buran over 5 years@sam, tkinter is not pre-installed on linux, at least not on all distros
-
Dinko Pehar over 4 yearsHi @TheProgramMAN123 if this or any answer has solved your question please consider accepting it by clicking the check-mark. This indicates to the wider community that you've found a solution and gives some reputation to both the answerer and yourself. There is no obligation to do this.
-
Vishwa Pratap almost 3 yearsyou can check my solution from here stackoverflow.com/questions/53797598/…