赞
踩
w.to_file("wordtest.png")
运行结果:Traceback (most recent call last):
File "D:\python练习文件\wordtest.py", line 6, in <module>
w.generate(txt)
File "D:\软件安装\python\lib\site-packages\wordcloud\wordcloud.py", line 571, in generate
return self.generate_from_text(text)
File "D:\软件安装\python\lib\site-packages\wordcloud\wordcloud.py", line 553, in generate_from_text
self.generate_from_frequencies(words)
File "D:\软件安装\python\lib\site-packages\wordcloud\wordcloud.py", line 405, in generate_from_frequencies
max_font_size=self.height)
File "D:\软件安装\python\lib\site-packages\wordcloud\wordcloud.py", line 439, in generate_from_frequencies
font = ImageFont.truetype(self.font_path, font_size)
File "D:\软件安装\python\lib\site-packages\PIL\ImageFont.py", line 261, in truetype
return FreeTypeFont(font, size, index, encoding, layout_engine)
File "D:\软件安装\python\lib\site-packages\PIL\ImageFont.py", line 144, in __init__
self.font = core.getfont(font, size, index, encoding, layout_engine=layout_engine)
OSError: cannot open resource
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。