Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/340.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在CentOS系统中使用PyeChars保存图片时出错_Python_Centos - Fatal编程技术网

Python 在CentOS系统中使用PyeChars保存图片时出错

Python 在CentOS系统中使用PyeChars保存图片时出错,python,centos,Python,Centos,我想可视化数据,但在使用pyechart时出现以下错误 File "/home/hadoop/Experiment/Ex2_WordCount/WordCount.py", line 83, in <module> resRdd = wordcount(isvisualize=True) File "/home/hadoop/Experiment/Ex2_WordCount/WordCount.py", line 74, in

我想可视化数据,但在使用pyechart时出现以下错误

  File "/home/hadoop/Experiment/Ex2_WordCount/WordCount.py", line 83, in <module>
    resRdd = wordcount(isvisualize=True)
  File "/home/hadoop/Experiment/Ex2_WordCount/WordCount.py", line 74, in wordcount
    v.drawPie(pieDic)
  File "/home/hadoop/Experiment/Ex2_WordCount/visualize.py", line 85, in drawPie
    make_snapshot(snapshot, pie_position().render(),SAVAPATH + 'result1.png')
  File "/usr/local/lib/python3.6/site-packages/pyecharts/render/snapshot.py", line 52, in make_snapshot
    save_as_png(image_data, output_name)
  File "/usr/local/lib/python3.6/site-packages/pyecharts/render/snapshot.py", line 77, in save_as_png
    with open(output_name, "wb") as f:
PermissionError: [Errno 13] Permission denied: '/home/hadoop/Experiment/Ex2_WordCount/results/result1.png'
可视化.py

Path/home/hadoop/Experiment/Ex2\u WordCount/results中没有任何内容

如果你能帮助我,我将非常高兴,谢谢

if isvisualize:
        v = visualize()
        pieDic = v.rdd2dic(resRdd,10)
        v.drawPie(pieDic)
        wwDic = v.rdd2dic(resRdd,50)
        v.drawWorcCloud(wwDic)
def drawPie(self, wordDic):
        key_list = wordDic.keys()      
        value_list = wordDic.values()

        def pie_position() -> Pie:
            c = (
                Pie()
                .add
                (
                    "",
                    [list(z)
                     for z in zip(key_list, value_list)],  # dic -> list
                    center=["35%", "50%"],
                )
                .set_global_opts
                (
                    title_opts=opts.TitleOpts(title='result1'),  
                    legend_opts=opts.LegendOpts(pos_left="15%"),
                )
                .set_series_opts(label_opts=opts.LabelOpts(formatter="{b}: {c}"))
            )
            return c
        make_snapshot(snapshot, pie_position().render(),SAVAPATH + 'result1.png')