注册 登录
编程论坛 Python论坛

请教各位大神: Python中已经配置好GraphViz,但是仍然不能运行plot tree

zhiyong75 发布于 2020-04-07 17:05, 1690 次点击
各位大神:

我在window系统已经安装好Graphviz,但是在python里面运行如下语句:

plot_tree(clf, num_trees=0), 系统报错如下:

ExecutableNotFound: failed to execute ['dot', '-Tpng'], make sure the Graphviz executables are on your systems' PATH

所有的工作感觉都做了,包括安装Graphviz,配置环境变量,不知道问题出在哪里,跪谢大神!
只有本站会员才能查看附件,请 登录
1 回复
#2
thhkb2020-04-11 23:47
你还要pip install pydot
如果还是有错,需要在pydot.py文件中修改
def set_prog(self, prog):
        """Sets the default program.

        Sets the default program in charge of processing
        the dot file into a graph.
        """
        #path = r'C:/Program File (x86)/Graphviz2.38/bin'
        #prog  = os.path.join(path, prog)
        #prog += '.exe'
        self.prog = prog
        #return prog
在def create()函数中修改
if prog is None:
            prog = self.prog
        
        assert prog is not None
        #prog = self.set_prog('dot') #调用函数
1