赞
踩
制作词云图出现错误
File “c:/Users/碎小流/Desktop/test/mooc/词云图.py”, line 6, in
from scipy.misc import imread
ImportError: cannot import name ‘imread’ from ‘scipy.misc’
解决办法:
pip3 install scipy==1.2.1
from imageio import imread
from PIL import Image
import numpy as np
img=Image.open('file_path') #打开文件,file_path为图片文件路径
mk=np.array(img) #将图片文件转为数组格式,然后在词云的设置中(mask=mk)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。