WordCloud安裝


1,下載

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

2,安裝    (window環境安裝)

找的下載文件的路徑   

安裝  

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

  

 

3,驗證是否安裝成功

添加英文數據的文件,比如我的是testfile.txt

文件內容為英文,比如

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:

1
2
3
4
5
6
7
8
9
10
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' ) //保存圖片

 

結果

如果還有問題未能得到解決,搜索887934385交流群,進入后下載資料工具安裝包等。最后,感謝觀看!

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM