1. 安装
2. 启动交互环境
3. 安装wordcloud
copy到工程位置(运行anaconda时候的路径)
开始编码做wordcloud
from wordcloud import WordCloud
f = open('红楼梦[304].txt', encoding='gbk').read()
wordcloud = WordCloud(background_color="white", width=1000, height=860, margin=2).generate(f)
import matplotlib.pyplot as plt
plt.imshow(wordcloud)
plt.axis("off")
plt.show()
wordcloud.to_file('test1.png')