首页 > 解决方案 > Graphviz 面临的问题

问题描述

我已经在我的 MacOS 上使用以下命令安装了 graphviz: brew install graphviz 现在它显示我的 graphviz 是最新的。

但是在我的 Jupyter 笔记本上运行以下代码时:

# Extract the small tree
tree_small = regressor1.estimators_[5]
# Save the tree as a png image
export_graphviz(tree_small, out_file = 'tree.dot', feature_names = home_data.columns, rounded = True, precision = 1)
(graph, ) = pydot.graph_from_dot_file('tree.dot')
graph.write_png('tree.png')

它抛出以下错误:

FileNotFoundError:[Errno 2] 在路径中找不到“点”。ExecutableNotFound:未能执行“点”,请确保 Graphviz 可执行文件位于您系统的 PATH*

如果有人可以帮助我,将不胜感激。PS:我是使用 MacOS 的新手,所以我不确定如何在 PATH 中添加点。我尝试做 echo $PATH,它当然不包括 graphviz,但不确定如何检查它的安装位置。

谢谢

标签: pythonpandasmacosgraphvizdot

解决方案


推荐阅读