首页上一页 1 下一页尾页 1 条记录 1/1页
039按图片轮廓绘制词云图运行故障,求解
发表在Python图书答疑
2020-08-15 悬赏:2 学分
《Python实效编程百例·综合卷》第3章 数据分析与图表 93页-94页
是否精华
是
否
版块置顶:
是
否
039按图片轮廓绘制词云图源程序: import matplotlib.pyplot as plt import jieba import wordcloud from scipy.misc import imread str1 = open('ycy.txt', 'r',encoding='utf-8').read() cut_text = jieba.cut(str1) word = ' '.join(cut_text) pic = imread('ycy1.jpg') wd = wordcloud.wordCloud( mask = pic, font_path = 'simhei.ttf', background_color = 'white' ) wd.generate(word) plt.imshow(wd) plt.axis('off') plt.show() 以下为故障代码: C:\Users\Administrator\AppData\Local\Programs\Python\Python38\python.exe D:/pyhtonjichu/python实效编程百例/0815/ycy.py Traceback (most recent call last): File "D:/pyhtonjichu/python实效编程百例/0815/ycy.py", line 1, in <module> import matplotlib.pyplot as plt File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\pyplot.py", line 2320, in <module> switch_backend(rcParams["backend"]) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\pyplot.py", line 260, in switch_backend class backend_mod(matplotlib.backend_bases._Backend): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\site-packages\matplotlib\pyplot.py", line 261, in backend_mod locals().update(vars(importlib.import_module(backend_name))) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "C:\Program Files\JetBrains\PyCharm 2017.3.3\helpers\pycharm_matplotlib_backend\backend_interagg.py", line 17, in <module> verbose = matplotlib.verbose AttributeError: module 'matplotlib' has no attribute 'verbose'
帐号只有2分,全部奉献,谢谢!