Closed SlightDust closed 1 year ago
@Lanly109 @SlightDust 并不需要这么麻烦。
在安装字体之前就安装了matplotlib的话需要删除matplotlib的缓存,这是matplotlib那边的问题,清除缓存以后即可正确读取到字体。
用jupyter搞炼丹的应该对这个问题很熟悉
另外,不建议对Python package进行修改,可能会出现潜在的问题。 对于Linux系统,缓存目录应该是:
~/.cache/matplotlib/*.json
对于Windows系统,缓存目录应为:
C:\Users\<Your User Name>\.matplotlib\*.json
@Lanly109 @SlightDust 并不需要这么麻烦。 在安装字体之前就安装了matplotlib的话需要删除matplotlib的缓存,这是matplotlib那边的问题,清除缓存以后即可正确读取到字体。 ~用jupyter搞炼丹的应该对这个问题很熟悉~
另外,不建议对Python package进行修改,可能会出现潜在的问题。 对于Linux系统,缓存目录应该是:
~/.cache/matplotlib/*.json
对于Windows系统,缓存目录应为:
C:\Users\<Your User Name>\.matplotlib\*.json
原来如此。学到了,感谢!
系统是Debian 11
尝试了把字体放在
resources/fonts
、/usr/share/fonts/meme
,然后fc-cache -fv
均无效。具体表现为
表情包制作
内显示方块,表情帮助 字符画
后台提示findfont: Font family ['Consolas'] not found. Falling back to DejaVu Sans.
最后参考了 http://bcxw.net/article/849.html
进入python命令行,执行
import matplotlib
print(matplotlib.matplotlib_fname())
应该会得到一个类似/usr/local/lib/python3.9/dist-packages/matplotlib/mpl-data/matplotlibrc
的路径,注意python版本号的区别然后进入这个路径下的
mpl-data/fonts/
路径,把其他用到的字体一股脑丢进来。root@debian:/usr/local/lib/python3.9/dist-packages/matplotlib/mpl-data/fonts/ttf# cp /usr/share/fonts/meme/* .
再次进入python命令行,执行
import matplotlib
print(matplotlib.get_cachedir())
应该会得到一个类似/root/.cache/matplotlib
的路径把这个路径下的内容删干净
rm -rf /root/.cache/matplotlib/*
然后重启Hoshino,应该就可以了
猜测是meme_generator用了mpl但是没有设置字体路径导致的。python小白,没翻meme_generator源码。
也不排除是系统或者python版本的原因。
附:系统信息