FileNotFoundError: [Errno 2] No such file or directory: '.\\static\\assets\\img\\ciyun.jpg'



```python
from matplotlib import pyplot as plt    #绘图,数据可视化
from wordcloud import WordCloud#词云
from PIL import Image      #图片处理
import numpy as np     #矩阵运算
import sqlite3     #数据库
import jieba

#准备词云所需的文字(词)

f = open(r'C:\Users\haha\密码.exe', encoding = 'utf-8')
text= f.read()
f.close()
cut=jieba.cut(text)
string=' '.join(cut)
print(len(string))


img=Image.open(r'.\static\assets\img\style.jpg')#打开遮罩图片
img_array=np.array(img)#将图片转换为数组
wc=WordCloud(
    background_color='white',
    mask=img_array,
    font_path=r'C:/Windows/Fonts/msyh.ttc'#字体所在位置:C:\windows\Fonts
)

wc.generate_from_text(string)
#wc=WordCloud(collocations=False,font_path=font,width=1400,height=1400,margin=2).generate(text.lower())
#绘制图片
fig=plt.figure(1)
plt.imshow(wc)
plt.axis('off')#是否显示坐标轴
plt.savefig(r'.\static\assets\img\mm.jpg',dpi=600)#dpi是调节清晰度
plt.show()#显示词云

#输出词云图片到文件

```


@app.task
def gen_world(article_content,sha1):
    article_lcut, article_content_important = seg_depart(article_content, 10)
    fo = wordcloud.WordCloud(width=800, height=600, font_path=r"simhei.ttf")

    # 词云需要的是字符串然后进行生成,对于article_lcut列表,中间用空格进行分割
    fo.generate(" ".join(article_lcut))
    fo.to_file('E:/code_home/PycharmProjects/mySpiderzwdtweb/media/article/ciyunimg/' + sha1 + '.jpg')
    return sha1 + '-ok'