【问题标题】:Matplotlibrc needs to be updated?Matplotlibrc 需要更新吗?
【发布时间】:2018-12-16 17:11:53
【问题描述】:

所以几周前我擦除了 Python 3.6,似乎错误地重新安装了 matplotlib 等,因为我遇到了很多不同的错误。

我正在尝试运行一个脚本,该脚本使用 subplot 并排显示多个图像。从命令行尝试过,效果很好。但是当我把它全部写在一个脚本中并尝试运行它时(我有大约 24 张图像),我收到以下错误:

您可能需要从以下位置获取更新的 matplotlibrc 文件 http://github.com/matplotlib/matplotlib/blob/master/matplotlibrc.template 或来自 matplotlib 源分布 Traceback(最近调用 最后):文件“./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,) + options) _tkinter.TclError:无法打开“/usr/share/matplotlib/mpl-data/images/matplotlib.gif”:没有这样的文件 或目录

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

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

Matplotlib 肯定是安装的,因为尝试绘制简单的东西是有效的,所以我不知道出了什么问题

【问题讨论】:

  • 如果matplotlib安装正确就不会出现这样的错误。现在很难知道您的安装出了什么问题。我想目的是完全删除 matplotlib 并重新安装。
  • 如何删除 matplotlib?

标签: python python-3.x ubuntu matplotlib


【解决方案1】:

我已经尝试并成功修复了这个错误。 首先,你应该通过

卸载matplotlib
pip uninstall matplotlib

然后,你再次安装它

pip install matplotlib

欢迎询问更多。

【讨论】:

    猜你喜欢
    • 2011-08-31
    • 1970-01-01
    • 2017-04-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-04
    • 1970-01-01
    相关资源
    最近更新 更多