WordCloud词云包的安装

1,下载python

https://www.lfd.uci.edu/~gohlke/pythonlibs/#wordcloudspa

2,安装    (window环境安装)blog

找的下载文件的路径   图片

安装  ip

pip install wordcloud-1.3.2-cp36-cp36m-win_amd64.whl

  

 

3,验证是否安装成功ci

添加英文数据的文件,好比个人是testfile.txtstring

文件内容为英文,好比it

Devouring Time, blunt thou the lion's paws,

And make the earth devour her own sweet brood;

Pluck the keen teeth from the fierce tiger's jaws,

And burn the long-lived phoenix in her blood;
。。。。。。。。

运行python:pip

from wordcloud import WordCloud

f = open(u'D:\PythonWorkspace\AI/testfile.txt', 'r').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')//保存图片

 

结果io

 

哈哈哈哈,就这么解决了。。。双击66666666666666666666666666666666666666

相关文章
相关标签/搜索