关于ubuntu下使用matplotlib画图的问题
首先,
import tkinter
然后报错如下:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'tkinter'
但是我已经sudo apt-get install python3-tk了啊
为什么还是找不到模块。目前用的python3
然后我在matplotlib下画图,也是报这个错。
import matplotlib.pyplot as plt
报错如下:
import matplotlib.pyplot as plt
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.6/dist-packages/matplotlib/pyplot.py", line 115, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/usr/local/lib/python3.6/dist-packages/matplotlib/backends/__init__.py", line 62, in pylab_setup
[backend_name], 0)
File "/usr/local/lib/python3.6/dist-packages/matplotlib/backends/backend_tkagg.py", line 4, in <module>
from . import tkagg # Paint image to Tk photo blitter extension.
File "/usr/local/lib/python3.6/dist-packages/matplotlib/backends/tkagg.py", line 5, in <module>
from six.moves import tkinter as Tk
File "/usr/lib/python3/dist-packages/six.py", line 92, in __get__
result = self._resolve()
File "/usr/lib/python3/dist-packages/six.py", line 115, in _resolve
return _import_module(self.mod)
File "/usr/lib/python3/dist-packages/six.py", line 82, in _import_module
__import__(name)
ModuleNotFoundError: No module named 'tkinter'
总之就是找不到tkinter,我也装了tkinter,而且什么tcl/tk也装了,就是找不到,求解决,浪费了很久时间了。
我早已用apt-get install python3-tk,但是还是找不到tkinter
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
pip install tkinter
sudo apt-get install python3.6-tk