我正在尝试使用MatPlotLib学习一些可视化。但是当我尝试导入库时,它给了我“tkinter”错误。您可以在下面看到我的代码和错误。
我的代码:
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()
错误:
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'
我尝试安装tkinter但它很好并且更新。如果有人能让我知道这个错误是什么,我将非常高兴。感谢。