在windows中
font = FontProperties(fname=r"c:\windows\fonts\simsun.ttc", size=14)
在Ubuntu中先要查看Ubuntu中自带的中文字体
查看字体可以用下面的方法:
1. 打开 LibreOffice 查看
2. 终端中查看(如)
终端中输入以下命令查看可用的中文字体: fc-list :lang=zh-cn
![](https://i-blog.csdnimg.cn/blog_migrate/7aedea1d6cb5c3873319cdb389f10ab4.png)
可以看到有中文字体,则把前面的地址作为fname
font = FontProperties(fname=r"/usr/share/fonts/truetype/wqy/wqy-microhei.ttc", size=14)
这样python代码即可正常运行