【问题标题】:Problems with "Matplotlib is building the font cache using fc-list. This may take a moment." on MacoS“Matplotlib 正在使用 fc-list 构建字体缓存。这可能需要一点时间。”的问题。在 MacOS 上
【发布时间】:2016-06-14 12:43:05
【问题描述】:

我运行的是 OS X 10.11.3,并且我已经安装了 Anaconda3-2.5.0-MacOSX-x86_64.pkg,其中包括 Matplotlib 1.5.1。当我尝试使用以下内容在 Jupyter 中导入 Matplotlib 时:

import matplotlib.pyplot as pp

我收到一条很长的错误消息,开头如下:

/Users/hgbauer/anaconda/lib/python3.5/site-packages/matplotlib/font_manager.py:273:用户警告:Matplotlib 正在使用 fc-list 构建字体缓存。这可能需要一点时间。

无论我等待多长时间,消息都不会消失。

我在一个相关帖子中注意到:

matplotlib taking time when being imported

这个问题可能需要删除 ~/.cache/matplotlib 的内容,但在这种情况下,Matplotlib 似乎是单独安装的,而不是作为 Anaconda 的一部分。

我的问题是这样的:

如何访问 Anaconda 中的 ~/.cache/matplotlib 文件以删除内容?

任何建议将不胜感激。

【问题讨论】:

  • mv ~/.matplotlib/ ~/.matplotlib_old 重新启动 python,如果它有效,则删除 ~/.matplotlib/

标签: macos matplotlib anaconda jupyter


【解决方案1】:

您可以通过get_cachedir() 找到它。例如在 python 2 中:

import matplotlib as mpl
print mpl.get_cachedir()

在 python 3 中:

import matplotlib as mpl
print(mpl.get_cachedir())

See here for more information

【讨论】:

    【解决方案2】:

    要删除的文件位于~/.matplotlib 下,而不是~/.cache/matplotlib(出于迷信,您还想删除~/.cache/fontconfig,但错误的.matplotlib 路径是大问题)

    您应该在下次运行时再次看到该讨厌的消息,然后就不会再看到了。

    【讨论】:

      猜你喜欢
      • 2018-08-22
      • 2016-12-28
      • 2019-06-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-22
      • 2020-10-24
      • 1970-01-01
      相关资源
      最近更新 更多