问题:
在做词云时,运行时出现该问题,wordcloud安装成功,但运行出错,错误提示是:cannot import name ‘WordCloud’ from partially initialized module ‘wordcloud’ (most likely due to a circular import)
错误提示代码:
Traceback (most recent call last): File "D:\mypythonprograms\wordcloud\wordcloud.py", line 4, in <module> import wordcloud #分词 File "D:\mypythonprograms\wordcloud\wordcloud.py", line 5, in <module> from wordcloud import WordCloud,ImageColorGenerator,STOPWORDS #词云,颜色生成器,停止 ImportError: cannot import name 'WordCloud' from partially initialized module 'wordcloud' (most likely due to a circular import) (D:\mypythonprograms\wordcloud\wordcloud.py) Process finished with exit code 1
解决方法:
文件名不能取"wordcloud.py" ,重命名后运行成功!
重命名:
运行成功: