关于pyecharts导入wordcloud、bar包失败等问题

由于作者少写了__init__文件,所以运行如下程序会出现导入不了的情况,即使换了很多个版本的pyecharts包也不行。

from pyecharts.charts.wordcloud import WordCloud
name =['Sam S Club', 'Macys', 'Amy Schumer', 'Jurassic World', 'Charter Communications', 'Chick Fil A', 'Planet Fitness', 'Pitch Perfect', 'Express', 'Home', 'Johnny Depp', 'Lena Dunham', 'Lewis Hamilton', 'KXAN', 'Mary Ellen Mark', 'Farrah Abraham', 'Rita Ora', 'Serena Williams', 'NCAA baseball tournament', 'Point Break']
value =[10000, 6181, 4386, 4055, 2467, 2244, 1898, 1484, 1112, 965, 847, 582, 555, 550, 462, 366, 360, 282, 273, 265]
wordcloud =WordCloud(width=1300, height=620)
wordcloud.add("", name, value, word_size_range=[20, 100])
wordcloud.show_config()
# wordcloud.render(path='5-01权重词云.html')
wordcloud.render(path='.html')

 

所以需要手动自己导入,改成这样就行了

from pyecharts.charts.wordcloud import WordCloud

你可能感兴趣的:(python学习笔记)