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.