Ununtu---解决 AttributeError: module 'matplotlib' has no attribute 'artist'
安装matplotlib的时候可能会出现输入import matplotlib.pyplot as plt出现报错的现象:
>>> from matplotlib import pyplot as plt
Traceback (most recent call last):
File "/usr/lib/python3.5/tkinter/__init__.py", line 36, in <module>
import _tkinter
ImportError: No module named '_tkinter'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/matplotlib/pyplot.py", line 2372, in <module>
switch_backend(rcParams["backend"])
File "/usr/local/lib/python3.5/dist-packages/matplotlib/pyplot.py", line 207, in switch_backend
backend_mod = importlib.import_module(backend_name)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/backend_tkagg.py", line 1, in <module>
from . import _backend_tk
File "/usr/local/lib/python3.5/dist-packages/matplotlib/backends/_backend_tk.py", line 5, in <module>
import tkinter as Tk
File "/usr/lib/python3.5/tkinter/__init__.py", line 38, in <module>
raise ImportError(str(msg) + ', please install the python3-tk package')
ImportError: No module named '_tkinter', please install the python3-tk package
解决方法:
没有GUI,无法画图,装载Tkinter
sudo apt install python3-tkinter
上一篇: css不起作用的原因是什么
推荐阅读
-
AttributeError: module ‘community‘ has no attribute ‘best_partition‘ 问题解决方法
-
【python】解决AttributeError: module ‘scipy.misc‘ has no attribute ‘toimage‘问题
-
运行sqlmap提示AttributeError: 'module' object has no attribute 'HTTPSHandler'解决方法
-
AttributeError: module ‘community‘ has no attribute ‘best_partition‘ 问题解决方法
-
python错误:AttributeError: 'module' object has no attribute 'setdefaultencoding'问题的解决方法
-
python错误:AttributeError: 'module' object has no attribute 'setdefaultencoding'问题的解决方法
-
出现AttributeError: module 'selenium.webdriver' has no attribute 'Firefox'的时候解决办法
-
【python】解决AttributeError: module ‘scipy.misc‘ has no attribute ‘toimage‘问题
-
AttributeError: module 'pip' has no attribute 'main'如何解决?
-
AttributeError: module 'pandas' has no attribute 'rolling_mean' 报错解决方法