我尝试运行 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/