我在Mac机器上尝试使用matplotlib,但我无法使用它生成任何迭代图。显示的UI上没有任何绘图,我看到引发了以下异常:
Exception in Tkinter callback
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk/Tkinter.py", line 1410, in __call__
return self.func(*args)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 245, in resize
self.show()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 249, in draw
tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/tkagg.py", line 19, in blit
tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox_array))
TclError
我尝试重新安装Tcl / Tk但结果仍然相同。还有什么我可以尝试的吗?每次我尝试生成交互式绘图时都会发生这种情况,静态(png)就可以了。
答案 0 :(得分:1)
我在Lion和python 2.7上运行它时遇到了同样的问题,但我的问题变得非常简单,或者更好,非常愚蠢;我已经为Mac OS 10.3安装了numpy和matplotlib,所以我为正确的版本10.6安装了它们,现在一切正常。顺便说一下,官方包可以在各自的sourceforge页面上找到,
答案 1 :(得分:-1)
我遇到了同样的问题,我发现这是因为matplotlib和numpy的混合版本,在我完全删除它们之后,重新安装它们,一切都变好了。