You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
'''Minimal Example===============参考:生成默认简单的词云图:https://github.com/amueller/word_cloud/blob/master/examples/simple.py'''fromwordcloudimportWordCloud# Read the whole text.text=open('/Users/fatli/Desktop/content.txt').read()
# Generate a word cloud image# 通过font_path参数来设置字体集,否则中文无法显示(显示为长方形格格)wordcloud=WordCloud(font_path="/Users/fatli/Library/Fonts/NotoSansHans-Regular.otf").generate(text)
# The pil way (if you don't have matplotlib)image=wordcloud.to_image()
image.show()
# 保存到文件wordcloud.to_file('01.png')
ImportError:
Importing the multiarray numpy extension module failed. Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes allfiles not under version control). Otherwise reinstall numpy.... ... Reason: image not found
The text was updated successfully, but these errors were encountered:
一、最简单的生成词云图片的方法
二、生成默认的简单的词云图
三、根据给定的图片形状生成词云
附:踩坑经历:
conda install wordcloud
会安装包括 numpy 在内的依赖包,这时需要先安装 numpy 后,再安装 wordcloud ,否则将会报错:The text was updated successfully, but these errors were encountered: