Matplotlibrc needs to be updated?

不打扰是莪最后的温柔 提交于 2021-02-10 22:24:05

问题


So I wiped Python 3.6 some weeks ago and seem to have incorrectly reinstalled matplotlib etc because I've been getting a bunch of errors for different things.

I'm trying to run a script that displays a number of images side by side using subplot. Tried it from the command line, worked fine. But when I write it all up in a script and try to run it (I have about 24 images) I get the following error:

You probably need to get an updated matplotlibrc file from http://github.com/matplotlib/matplotlib/blob/master/matplotlibrc.template or from the matplotlib source distribution Traceback (most recent call last): File "./merge_pics.py", line 8, in fig=plt.figure() File "/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 527, in figure **kwargs) File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 84, in new_figure_manager return new_figure_manager_given_figure(num, figure) File "/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 101, in new_figure_manager_given_figure icon_img = Tk.PhotoImage(file=icon_fname) File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 3370, in init Image.init(self, 'photo', name, cnf, master, **kw) File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 3324, in init self.tk.call(('image', 'create', imgtype, name,) + options) _tkinter.TclError: couldn't open "/usr/share/matplotlib/mpl-data/images/matplotlib.gif": no such file or directory

When I click on the link I can't tell where I'm supposed to get the updated matplotlibrc file.

I have tried wget http://github.... but still get the same error

Matplotlib is definitely installed because trying to plot simple things is working so I can't figure out what's going wrong


回答1:


I have tried and fixed this error successfully. Firstly, you should uninstall matplotlib by

pip uninstall matplotlib

Then, you install it again by

pip install matplotlib

Feel free to ask more.



来源:https://stackoverflow.com/questions/53804577/matplotlibrc-needs-to-be-updated

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