from matplotlib.backends import _tkagg ImportError: cannot import name _tkagg

馋奶兔 提交于 2019-12-03 10:36:50

I just ran into this (Ubuntu 15.10 but same idea) and fixed it by:

sudo apt-get install tk-dev
pip uninstall -y matplotlib
pip --no-cache-dir install -U matplotlib

I think the third step was the critical one; if the cache is permitted then pip appeared to be just using the previously-built installation of matplotlib.

You can also manually remove the previously-built matplotlib; on Ubuntu it lives in ~/.cache/pip somewhere. (I couldn't find a way for pip to clean up its cache unfortunately.)

Try following this scenario:

sudo apt-get update

sudo apt-get install tk tk-dev

sudo pip uninstall matplotlib 

sudo pip install matplotlib

EDIT:

Try:

sudo pip uninstall matplotlib 

sudo apt-get install python-matplotlib

EDIT2:

sudo apt-get install tk8.6-dev

sudo apt-get remove python-matplotlib

sudo apt-get install python-matplotlib

One answer to this question suggests the error is due to a missing Visual C++ Redistributable for Visual Studio 2015 . Installing it solved the problem for me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!