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