Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
330 views
in Technique[技术] by (71.8m points)

python - python3.3 matplotlib cannot import name _tkagg

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.

I use python3.3 on Quantal if that has any relevance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I was getting the same error on Fedora 18. I installed the matplotib package for Python 3 from the repository.

Installing the package python3-matplotlib-tk got rid of this error for me on Fedora.

On Ubuntu, install the tk-dev package, and install matplotlib again: python3 setup.py build and python3 setup.py install.

However, I soon ran into this one on Fedora: Python 3 and matplotlib lissue on Linux


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...