zoukankan      html  css  js  c++  java
  • WordCloud词云包的安装

    1,下载

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

    2,安装    (window环境安装)

    找的下载文件的路径   

    安装  

    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:

    from wordcloud import WordCloud
    
    f = open(u'D:PythonWorkspaceAI/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')//保存图片

    结果

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

  • 相关阅读:
    20135313_exp4
    20135313_exp5
    学习分块
    学习BM算法
    学习笛卡尔树
    【数学】Eddy Walker
    【bitset】Kth Minimum Clique
    【搜索】n的约数
    【搜索】Partition problem
    【信息学奥赛一本通 提高组】第四章 广搜的优化技巧
  • 原文地址:https://www.cnblogs.com/hanyu258/p/7966657.html
Copyright © 2011-2022 走看看