首页 > 编程语言 >python3.6使用wordcloud 1.9报错ValueError: Only supported for TrueType fonts

python3.6使用wordcloud 1.9报错ValueError: Only supported for TrueType fonts

时间:2023-08-29 20:00:20浏览次数:74  
标签:box self fonts wordcloud Only 报错 font margin size

该版本的wordcloud的源码中显示不兼容python3.6 

解决办法:修改wordcloud源码

修改前

 508: box_size = draw.textbox((0, 0), word, font=transposed_font, anchor="lt")
           
 510:  result = occupancy.sample_position(box_size[3] + self.margin,
                                                   box_size[2] + self.margin,
                                                   random_state)

修改后

508:  box_size = draw.textsize(word, font=transposed_font)
510: result = occupancy.sample_position(box_size[1] + self.margin,
                                                   box_size[0] + self.margin,

标签:box,self,fonts,wordcloud,Only,报错,font,margin,size
From: https://www.cnblogs.com/liyiyang/p/17665726.html

相关文章