一切正常,直到“graph.render("iris")”行。然后我得到这个错误:ExecutableNotFound: failed to execute ['dot', '-Tpdf', '-O', 'iris'],确保 Graphviz 可执行文件在你系统的路径上
graph.render("iris")
Traceback (most recent call last):
File "<ipython-input-13-c002c0ff127c>", line 1, in <module>
graph.render("iris")
File "C:\Users\Rafay\Anaconda3\lib\site-packages\graphviz\files.py", line
175, in render
rendered = backend.render(self._engine, self._format, filepath)
File "C:\Users\Rafay\Anaconda3\lib\site-packages\graphviz\backend.py", line
127, in render
raise ExecutableNotFound(args)
ExecutableNotFound: failed to execute ['dot', '-Tpdf', '-O', 'iris'], make
sure the Graphviz executables are on your systems' PATH
Run Code Online (Sandbox Code Playgroud)
我有 Windows 10,正在使用 Anaconda 和 spyder。完整代码如下:
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import load_iris
from sklearn.tree …Run Code Online (Sandbox Code Playgroud)