Ubuntu的默認中文是哪種呢?
fc-list :lang=zh
用這個命令查看出來
NotoSerifCJK-Bold.ttc
為什么要知道這個呢?
來看一塊python3代碼
import jieba
import wordcloudf = open("threekingdom.txt","rb")
t = f.read()
f.close()
ls = jieba.lcut(t)
txt = " ".join(ls)
w = wordcloud.WordCloud( font_path = "NotoSerifCJK-Bold.ttc",\width = 1000,height = 700,background_color = "white",\) w.generate(txt)
w.to_file("gr.png")