原因是你运行了两遍WordCloud方法,第二次运行该方法时,只指定了background_color,其他参数没传,就用默认值更新了一遍;
你这里第二次执行相当于font_path=None, width=400, height=200
当font_path不传的时候,默认是DroidSansMono.ttf,你系统里没这个字体,就显示为框框了。
正确的使用方式是,只执行一遍WordCloud方法
w = wordcloud.WordCloud(width=1000, font_path='C:\Windows\Fonts\simsun.ttc', height=1000, background_color='pink')
你把