问题描述
我需要使用 Tkagg backent 在 Tkinter 程序中使用 matplotlib,并且收到ImportError: No module named backend_tkagg"错误消息.
I need to use the Tkagg backent to use matplotlib in a Tkinter program, and I received the "ImportError: No module named backend_tkagg" error message.
环顾四周,我看到添加了一个安装agg-dev库的可能解决方案,所以我做了(这里是Fedora fc13): yum install agg agg-devel ...但是问题仍然存在.
Looking around, I saw as one possible solution that I add to install the agg-dev libs, so I did (Fedora fc13 here): yum install agg agg-devel... but the problem persisted.
我想也许我必须重新安装 matplotlib,所以我发出了 *easy_install -m matplotlib*,但没有运气(尽管现在似乎相同的错误消息来自不同的文件,即/usr/lib64/python2.6/site-packages/matplotlib/backends/init.py )
I thought that maybe I had to reinstall matplotlib, so I issued a *easy_install -m matplotlib*, but no luck (though the same error message seems to come from a different file now, namely /usr/lib64/python2.6/site-packages/matplotlib/backends/init.py )
有什么想法吗?
推荐答案
我是通过从源代码编译 matplotlib
来解决此问题的.默认情况下,它已激活 Tkagg.唯一的问题是它没有编译Tkagg,因为我没有安装tk-devel ...安装后一切正常.
I solved it by compiling matplotlib
from source. It has Tkagg active by default.Only problem was it didn't compile Tkagg since I didn't have tk-devel installed... after installing it everything went ok.
所以我仍然不知道 easy_install matplotlib
是否在设计上没有使用 TkAgg,或者它是否也检查并注意到我没有 Tk.h
已安装,但无论如何这是要走的路.
So I still don't know if easy_install matplotlib
doesn't use TkAgg by design, or if it too checked and noticed that I didn't have Tk.h
installed, but anyway this is the way to go.
这篇关于tkagg 后端问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!