Matplotlibrc是否需要更新? [英] Matplotlibrc needs to be updated?

查看:56
本文介绍了Matplotlibrc是否需要更新?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以几周前我擦掉了Python 3.6,并且似乎错误地重新安装了matplotlib等,因为我在遇到其他事情时遇到了很多错误.

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.

我正在尝试运行一个脚本,该脚本使用子图并排显示许多图像.从命令行尝试过,工作正常.但是,当我将其全部写在脚本中并尝试运行它时(我有大约 24 张图像),我收到以下错误:

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:

您可能需要从以下位置获取更新的matplotlibrc文件 http://github.com/matplotlib/matplotlib/blob/master/matplotlibrc.模板或来自 matplotlib 源代码分发回溯(最近调用最后):文件./merge_pics.py",第 8 行,在fig = plt.figure()文件"/usr/lib/python2.7/dist-packages/matplotlib/pyplot.py",第527行,在数字** kwargs)文件"/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py",第84行,在new_figure_manager中返回 new_figure_manager_given_figure(num, figure) 文件/usr/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py",第101行,在new_figure_manager_given_figure中icon_img = Tk.PhotoImage(file = icon_fname)文件"/usr/lib/python2.7/lib-tk/Tkinter.py",第3370行,在 init 中Image.init(self, 'photo', name, cnf, master, **kw) File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 3324,在初始化中self.tk.call(('image', 'create', imgtype, name,) + 选项)_tkinter.TclError:无法打开"/usr/share/matplotlib/mpl-data/images/matplotlib.gif":没有这样的文件或目录

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

当我点击链接时,我不知道应该在哪里获取更新的 matplotlibrc 文件.

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

我已经尝试过 wget http://github.... 但仍然得到同样的错误

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

肯定安装了 Matplotlib,因为尝试绘制简单的东西是有效的,所以我无法弄清楚出了什么问题

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

推荐答案

我已经尝试并成功修复了此错误.首先,您应该通过

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

pip uninstall matplotlib

然后,你再安装

pip install matplotlib

随时问更多.

这篇关于Matplotlibrc是否需要更新?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆