python 词云运行不了



```python
import jieba
from collections import Counter
import codecs
data['content'] = data['content'].astype('str')
text = ''.join(data['content'])
words = list(jieba.cut(text))#jieba分词
swords = [x.strip() for x in codecs.open('D:\PycharmProjects\pythonProject5\stop.txt', encoding='utf-8')]#读取停用词列表
#添加停用词
swords.append("超话")
swords.append("网站")
swords.append("网页")
swords.append("链接")
swords.append("cn")
swords.append("微博")
swords.append("视频")
swords.append("收起")
swords.append("展开")
swords.append("现在")
swords.append("已经")
ex_sw_words = []
for word in words:
    if len(word)>1 and (word not in swords):
        ex_sw_words.append(word)
import numpy as np
import matplotlib.pyplot as plt
from wordcloud import WordCloud, ImageColorGenerator
import PIL.Image as Image
#词云图绘制
my_wordcloud = WordCloud(background_color="white",
 max_words=200,
 max_font_size=60,
 random_state=42,
 scale=2,
font_path="./SimHei.ttf").generate(' '.join(ex_sw_words))
plt.figure(figsize=(10,10))
plt.axis("off")
plt.imshow(my_wordcloud.recolor())
plt.show()

img

这是什么问题啊

这个代码在运行前可能需要设置几个条件,包括:

data数据框是否已经存在
data数据框的'content'列是否存在
jieba包是否已经安装
字体文件是否存在。
如果在缺少以上条件的情况下运行代码,则可能导致错误。