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

后端 未结 5 1668
不思量自难忘°
不思量自难忘° 2021-02-05 10:53

While trying to run this example to test how matplotlib works with Tkinter, I am getting the error:

(env)fieldsofgold@fieldsofgold-VirtualBox:~/new$ python test.         


        
5条回答
  •  有刺的猬
    2021-02-05 11:38

    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.)

提交回复
热议问题