OS X 上的 matplotlib TclError
我正在 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)绘图没问题。
I'm trying matplotlib on a Mac machine and I can't generate any iterative plots with it. The UI is displayed without any plot on it and I see the following exception being raised:
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
I have tried reinstalling Tcl/Tk but the result is still the same. Is there anything else I can try? This happens every time I try to generate an interactive plot, the static (png) ones are ok.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在 Lion 和 python 2.7 上运行它时遇到了同样的问题,但我的问题变得非常简单,或者更好的是,非常愚蠢;我已经为 Mac OS 10.3 安装了 numpy 和 matplotlib,因此我为正确的版本 10.6 安装了它们,现在一切正常。顺便说一句,官方软件包可以在各自的 sourceforge 页面上找到,
I had this very same problem running it on Lion and python 2.7, but my problem turned to be very simple, or better yet, very stupid; I had installed numpy and matplotlib for Mac OS 10.3, so I installed them both for the correct version 10.6 and now everything is working. btw, official packages can be found on their respective sourceforge pages,
我也遇到了同样的问题,我发现这是因为matplotlib和numpy的混合版本,在我完全删除它们并重新安装它们后,一切都变得很好。
I had the same problem, and I found that it is because the mixed version of matplotlib and numpy, after I remove them completely, and reinstall them, everything becomes good.