Unable to “import matplotlib.pyplot as plt” in virtualenv

This solution worked for me. If you already installed matplotlib using pip on your virtual environment, you can just type the following:

$ cd ~/.matplotlib
$ nano matplotlibrc

And then, write backend: TkAgg in there.
If you need more information, just go to the solution link.

Leave a Comment