findfont: Generic family sans-serif not found because none of the following families were found: SimHei
时间: 2023-12-28 08:40:53 浏览: 603
回答: 这个问题是由于找不到字体家族'sans-serif'导致的。根据引用\[1\]和引用\[2\]的报错信息,可以看出在系统中找不到SimHei字体。为了解决这个问题,你可以按照引用\[3\]中的步骤进行操作。首先,在Python环境中输入以下代码来查看字体路径:import matplotlib matplotlib.matplotlib_fname()。这将显示matplotlib的配置文件路径。然后,你可以将SimHei字体文件复制到该路径下的字体文件夹中。这样,当你再次运行程序时,就能够找到并使用SimHei字体了。
#### 引用[.reference_title]
- *1* [解决linux服务器上matplotlib绘图中文显示方框问题](https://blog.csdn.net/liu_xzhen/article/details/122881997)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [linux下python matplotlib 中文字体Font family [‘sans-serif‘] not found. Falling back to DejaVu Sans](https://blog.csdn.net/sinat_36728101/article/details/124349841)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [解决使用matplotlib.pyplot画图包含中文乱码显示问题(macbook上 family ‘sans-serif‘ not found 问题)](https://blog.csdn.net/ben_na_/article/details/124238611)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^koosearch_v1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文