python词云图怎么做

 时间:2024-10-14 22:44:36

1、安装python3.6

2、安装vscode并配置python插件

3、安装WordClou蟠校盯昂d1.6.0。1.win+R打开运行,输入cmd进入命令行。2.输入pip install wordcloud,回车安装。

4、新建一个名为wordcloud的文竭惮蚕斗件夹,文件夹下新建main.py文件。在此文件夹下右键,点击open with code,用vs code打开项目。

5、编辑main.py,写入如下代码:importwordcloudword=wordcloud.WordCloud().generate烫喇霰嘴('''WhenIdocounttheclockthattellsthetime,Andseethebravedaysunkinhideousnight;WhenIbeholdthevioletpastprime,Andsablecurlsallsilver'do'erwithwhite:WhenloftytreesIseebarrenofleaves,Whicherstfromheatdidcanopytheherd,Andsummer'sgreen,allgirdedupinsheaves,Bornonthebierwithwhiteandbristlybeard;ThenofthybeautydoIquestionmake,Thatthouamongthewastesoftimemustgo,Sincesweetsandbeautiesdothemselvesforsake,Anddieasfastastheyseeothersgrow;Andnothing'gainstTime'sscythecanmakedefenceSavebreed,tobravehimwhenhetakestheehence.''')#三引号之间的文本,换成你想要的文本pic=word.to_image()pic.show()

6、在vscode的编辑页面右上角有一个绿色箭头标志,点击即可运行代码,得到词云图片。

python词云图怎么做
  • AutoCAD背景怎么换成白色
  • AutoCAD二维绘图训练一百八十之回形内倒角
  • cad点划线怎么画
  • cad怎么设置标注尺寸字体字号
  • autocad旋转形状时怎么保留原形状
  • 热门搜索
    右斜杠怎么打 头七怎么做 怎么查询电脑配置 爱心图片大全 游戏大全小游戏 炖菜菜谱大全 日本工口里番大全全彩 辽宁师范大学怎么样 鸽子简笔画图片大全 十大元帅简介