|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
- import matplotlib.pyplot as plt
- squares = [1, 4, 9, 16, 25]
- plt.plot(squares)
- plt.show()
复制代码
代码如上,run moudle时报错,内容如下:
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\yiming\AppData\Roaming\Python\Python34\site-packages\matplotlib\backends\tkagg.py", line 26, in blit
dataptr, colormode, bboxptr)
_tkinter.TclError: invalid command name "PyAggImagePhoto"
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python34\lib\tkinter\__init__.py", line 1533, in __call__
return self.func(*args)
File "C:\Users\yiming\AppData\Roaming\Python\Python34\site-packages\matplotlib\backends\backend_tkagg.py", line 228, in resize
self.draw()
File "C:\Users\yiming\AppData\Roaming\Python\Python34\site-packages\matplotlib\backends\backend_tkagg.py", line 300, in draw
tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
File "C:\Users\yiming\AppData\Roaming\Python\Python34\site-packages\matplotlib\backends\tkagg.py", line 34, in blit
dataptr, colormode, bboxptr)
_tkinter.TclError: error reading data, expected ptr height width
Exception in Tkinter callback
Traceback (most recent call last):
File "C:\Users\yiming\AppData\Roaming\Python\Python34\site-packages\matplotlib\backends\tkagg.py", line 26, in blit
dataptr, colormode, bboxptr)
_tkinter.TclError: error reading data, expected ptr height width
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\yiming\AppData\Roaming\Python\Python34\site-packages\matplotlib\backends\tkagg.py", line 26, in blit
dataptr, colormode, bboxptr)
_tkinter.TclError: error reading data, expected ptr height width
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python34\lib\tkinter\__init__.py", line 1533, in __call__
return self.func(*args)
File "C:\Python34\lib\tkinter\__init__.py", line 582, in callit
func(*args)
File "C:\Users\yiming\AppData\Roaming\Python\Python34\site-packages\matplotlib\backends\backend_tkagg.py", line 320, in idle_draw
self.draw()
File "C:\Users\yiming\AppData\Roaming\Python\Python34\site-packages\matplotlib\backends\backend_tkagg.py", line 300, in draw
tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
File "C:\Users\yiming\AppData\Roaming\Python\Python34\site-packages\matplotlib\backends\tkagg.py", line 34, in blit
dataptr, colormode, bboxptr)
_tkinter.TclError: error reading data, expected ptr height width
图片也显示了,但是没有曲线,是空白的,哪位鱼油能帮忙看看是什么原因?matplotlib我已经安装成功了的,导入模块什么的也是正常的。
实测安装好matplotlib后,代码没有问题
我怀疑你安装的matplotlib版本和你的python版本不匹配
|
|