TclError when creating plots using mpld3 in pythonanywhere

203 Views Asked by At

I am creating plots using matplotlib and mpld3 (both successfully installed) but when plotting I got this error message:

...File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1767, in init#012 self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)#012TclError: no display name and no $DISPLAY environment variable.

Any idea how to solve that? thanks for your help

1

There are 1 best solutions below

4
On BEST ANSWER

Try this

import matplotlib
matplotlib.use('Agg')

Check this page for more informations