每次运行 Matplotlib 弹出警告

python 使用matplotlib,import matplotlib.pyplot as plt,某次开始弹出警告

font_manager.py:273: UserWarning: Matplotlib is building the font cache using fc-list. This may take a moment.
  warnings.warn('Matplotlib is building the font cache using fc-list. This may take a moment.')

Google一下之后,stackoverflow的回答:

As tom suggested in the comment above, deleting the files:

fontList.cache
fontList.py3k.cache
tex.cache
solve the problem. In my case the files were under:

~/.matplotlib
EDITED

A couple of days ago the message appeared again, I deleted the files in the locations mention above without any success. I found that as suggested here by T Mudau there’s an extra location with text cache files is: ~/.cache/fontconfig

删除缓存文件。亲测有效,只会再出现一次警告,之后运行都没有警告了
The warning should now appear only the next time that matplotlib.pyplot is imported, and not afterwards.

    原文作者:aurora6102
    原文地址: https://www.jianshu.com/p/2769f148983c
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞