python - pydot.InvocationException : GraphViz's executables not found

标签 python scipy graphviz pydot

我尝试运行 this example用于决策树学习,但得到以下错误信息:

File "coco.py", line 18, in graph.write_pdf("iris.pdf") File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pydot.py", line 1602, in lambda path, f=frmt, prog=self.prog : self.write(path, format=f, prog=prog)) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pydot.py", line 1696, in write dot_fd.write(self.create(prog, format)) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pydot.py", line 1727, in create 'GraphViz\'s executables not found' ) pydot.InvocationException: GraphViz's executables not found

我看到了this post关于类似的错误,但即使我按照他们的解决方案(卸载然后以相反的顺序重新安装 graphviz 和 pydot)问题仍然存在......我正在使用 MacOS(优胜美地)。

有什么想法吗?非常感谢您的帮助。

最佳答案

cel,在评论中回答了这个问题:

Graphviz is not a python tool. The python packages at pypi provide a convenient way of using Graphviz in python code. You still have to install the Graphviz executables, which are not pythonic, thus not shipped with these packages. You can install those e.g. with a general-purpose package manager such as homebrew

就我个人而言,在 ubuntu 14.04 上,我所要做的就是:

sudo apt-get install graphviz

关于python - pydot.InvocationException : GraphViz's executables not found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27666846/

相关文章:

python - 如何在 Python 中使用 PCA/SVD 进行特征选择和识别?

python - Python 中的拱形关系信息图

alignment - 在Graphviz中垂直对齐连接子图的节点

python - 如何将默认的python版本从python v2.7更改为python 3.7?

Python 列合并

python - pyspark计算稀疏向量的距离矩阵

python - 使用 find_peaks 查找局部最大值

graphviz - 如何在 GraphViz 中使用样条曲线 ="curved"设置边的弯曲方向? (使用neato)

python - 如何在 py2app 中包含 NSUserNotificationCenter

python - 将多边形框添加到cartopy python