python3.3 matplotlib 无法导入名称_tkagg [英] python3.3 matplotlib cannot import name _tkagg
问题描述
我的 matplotlib 的默认后端是agg".我阅读了stackoverflow(如何在matplotlib中设置后端"Python?),为了显示图形,我需要使用TkAgg,WX,QTAgg或QT4Agg.我尝试使用所有4个(mpl.use('TkAgg')等),而matplotlib找不到它们中的任何一个(我不能使用QTAgg或QT4Agg,因为根据matplotlib,它与python3不兼容).我不确定出了什么问题,因为当我去/usr/local/lib/python3.3/dist-packages/matplotlib/backends/时,tkagg.py 和 backend_tkagg.py 都在那里.这些错误同样也适用于wx.
The default backend for my matplotlib is 'agg'. I read on stackoverflow (How can I set the 'backend' in matplotlib in Python?) that in order to display graphics I need to use TkAgg, WX, QTAgg, or QT4Agg. I tried using all 4 (mpl.use('TkAgg') etc) and matplotlib cannot find any of them (I cannot use QTAgg or QT4Agg because it is not compatible with python3 according to matplotlib). I'm not sure what is wrong since when I go to /usr/local/lib/python3.3/dist-packages/matplotlib/backends/, tkagg.py and backend_tkagg.py are both there. These errors all apply to wx also.
如果有相关性,我会在Quantal上使用python3.3.
I use python3.3 on Quantal if that has any relevance.
推荐答案
我在 Fedora 18 上遇到了同样的错误.我从存储库安装了 Python 3 的 matplotib 包.
I was getting the same error on Fedora 18. I installed the matplotib package for Python 3 from the repository.
在Fedora上为我安装软件包 python3-matplotlib-tk
消除了此错误.
Installing the package python3-matplotlib-tk
got rid of this error for me on Fedora.
在Ubuntu上,安装 tk-dev
软件包,然后再次安装matplotlib: python3 setup.py build
和 python3 setup.py install
.
On Ubuntu, install the tk-dev
package, and install matplotlib again: python3 setup.py build
and python3 setup.py install
.
但是,我很快就在Fedora上遇到了这个问题:在Linux上的Python 3和matplotlib lissue
However, I soon ran into this one on Fedora: Python 3 and matplotlib lissue on Linux
这篇关于python3.3 matplotlib 无法导入名称_tkagg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!