Graphviz 调用异常:程序终止,状态为:322225477

Graphviz 调用异常:程序终止,状态为:322225477,graphviz,pydot,Graphviz,Pydot,我正在尝试使用pydotplus可视化决策树。下面是代码片段 if image_file_name is not None: dot_data = export_graphviz(decision_tree_model, feature_names=features,out_file=None,filled=True,rounded=True) graph = pydotplus.graph_from_dot_data(dot_data) colors = ('tu

我正在尝试使用pydotplus可视化决策树。下面是代码片段

if image_file_name is not None:

    dot_data = export_graphviz(decision_tree_model, feature_names=features,out_file=None,filled=True,rounded=True)

    graph = pydotplus.graph_from_dot_data(dot_data)

    colors = ('turquoise', 'orange')

    edges = collections.defaultdict(list)

    for edge in graph.get_edge_list():

         edges[edge.get_source()].append(int(edge.get_destination()))

    for edge in edges:

        edges[edge].sort()    

        for i in range(2):

            dest = graph.get_node(str(edges[edge][i]))[0]

            dest.set_fillcolor(colors[i])

    graph.write_png(image_file_name)
无论何时执行最后一条语句,我都会收到此消息

我执行的故障排除步骤:

  • 已卸载Anaconda和Python
  • 重新安装了Python和Anaconda
  • 安装了Graphviz和Pydotplus,并将Graphviz目录的路径添加到系统路径
  • 启动Jupyter笔记本终端并尝试执行代码。但这个问题仍然没有得到解决 使用的Python版本:3.7.1

    使用的蟒蛇版本:蟒蛇A3-5.3.1

    有人能从这里帮助我吗