noamgot noamgot - 1 year ago 638
Python Question

matplotlib error - no module named tkinter

I tried to use the matplotlib package via Pycharm IDE on windows 10.
when I run this code:

from matplotlib import pyplot

I get the following error:

ImportError: No module named 'tkinter'

I know that in python 2.x it was called Tkinter, but that is not the problem - I just installed a brand new python 3.5.1.

EDIT: in addition, I also tried to import 'tkinter' and 'Tkinter' - neither of these worked (both returned the error message I mentioned).

any ideas?
thanks in advance

Answer Source
sudo apt-get install python3-tk


>> import tkinter # all fine


For Windows, I think the problem is you didn't install complete Python package. Since Tkinter should be shipped with Python out of box. See:

I suggest install ipython, which provides powerful shell and necessary packages as well.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download