0

I am trying to learn some visualization with MatPlotLib. But when I try to import library it gives me "tkinter" error. You can see below my code and error.

My Code:

import pandas as pd
import matplotlib.pyplot as plt
import sys
plt.plot([3,4,2,5,7],[7,3,5,4,1])
plt.show()

Error:

Traceback (most recent call last):
File "pda.py", line 5, in <module>
import matplotlib.pyplot as plt
File "C:\Python36\lib\site-packages\matplotlib\pyplot.py", line 113, in 
<module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "C:\Python36\lib\site-packages\matplotlib\backends\__init__.py", line 
60, in pylab_setup
[backend_name], 0)
File "C:\Python36\lib\site-packages\matplotlib\backends\backend_tkagg.py", 
line 6, in <module>
from six.moves import tkinter as Tk
File "C:\Python36\lib\site-packages\six.py", line 92, in __get__
result = self._resolve()
File "C:\Python36\lib\site-packages\six.py", line 115, in _resolve
return _import_module(self.mod)
File "C:\Python36\lib\site-packages\six.py", line 82, in _import_module
__import__(name)
ModuleNotFoundError: No module named 'tkinter'

I try to install tkinter but it's good and update. If anyone can give me idea what's this error, I will be very happy. Thanks.

Mahir Yıldızhan
  • 53
  • 1
  • 2
  • 11
  • On a mac, you need to install TCL/TK – Reblochon Masque Oct 31 '17 at 15:26
  • I am using windows 10. – Mahir Yıldızhan Oct 31 '17 at 15:31
  • You have a very strange install of Python. Not only is tkinter supposed to come with python for windows, but it usually installs to a different place too. I recommend you wipe python from your computer and reinstall it. If you will be using a lot of scientific packages install something like Anaconda which includes many popular packages like matplotlib. – Novel Oct 31 '17 at 16:29
  • What's the differents between pip and Anacında. Because I use pip and in some case it's giving some stupid errors. And What If I use pycharm while I'm using my program. Isn't it gives errors for packages. – Mahir Yıldızhan Nov 01 '17 at 08:44

0 Answers0