【问题标题】:Graphviz executables not found未找到 Graphviz 可执行文件
【发布时间】:2016-12-18 20:00:30
【问题描述】:

我熟悉关于这个问题已经存在的各种线程。

我在 Windows 7 机器上。我只是想运行示例代码来绘制决策树:

from sklearn.datasets import load_iris
from sklearn import tree
clf = tree.DecisionTreeClassifier()
iris = load_iris()
clf = clf.fit(iris.data, iris.target)

from sklearn.externals.six import StringIO
import pydotplus

dot_data = StringIO() 
tree.export_graphviz(clf, out_file=dot_data) 
graph = pydotplus.graph_from_dot_data(dot_data.getvalue()) 
graph.write_pdf("iris.pdf") 

我安装了 graphviz 并将其添加为 PATH 变量。 在安装了 python 的 graphviz 库之后,我安装了 pydot(现在是 pydotplus)。 我仍然收到错误:

InvocationException: GraphViz's executables not found

【问题讨论】:

    标签: python-2.7 scikit-learn graphviz


    【解决方案1】:

    It looks like the installer isn't setting the PATH variable for you,您需要手动将 Graphviz 的安装文件夹添加到您的 PATH 中。

    【讨论】:

    • 我忘了提到我已经手动添加了路径。我编辑了我的问题以添加该细节。事实证明我只需要重新启动我的机器。今天早上开始工作了。
    猜你喜欢
    • 2018-07-29
    • 2023-03-06
    • 2015-02-24
    • 2017-09-18
    • 2021-03-22
    • 2015-04-03
    • 2018-01-25
    • 2017-11-05
    • 1970-01-01
    相关资源
    最近更新 更多