我在Windows7上运行Python3.4。我正在尝试使用Python接口进行graphviz。这是我打算运行的脚本:
from graphviz import Digraph
import pydotplus
dot = Digraph(comment='The Round Table')
dot.node('A', 'King Arthur')
dot.node('B', 'Sir Bedevere the Wise')
dot.node('L', 'Sir Lancelot the Brave')
dot.edges(['AB', 'AL'])
dot.edge('B', 'L', constraint='false')
print(dot.source)
dot.render('test-output/round-table.gv', view=True)
我在运行时得到以下错误:
RuntimeError: failed to execute ['dot', '-Tpdf', '-O', 'test-output/round-table.gv'], make sure the Graphviz executables are on your systems' path
现在我确信我已经正确地安装了正确的依赖项。我首先尝试设置正确的环境变量。graphviz可执行文件位于
C:\Program Files (x86)\Graphviz2.37\bin
所以我去了环境变量部分。有两个部分:用户变量和系统变量。在系统变量下,我单击了
路径
然后单击
并添加了
;C:\Program Files (x86)\Graphviz2.37\bin
添加到字符串的末尾并保存。这并没有清除错误。
然后,按照下面的答案
在这里给出
我卸载了pydot (实际上我在这里使用的是pydotplus ),然后重新安装,但仍然没有成功。
我已经尝试了几个小时来解决这个问题,整个路径变量的事情就是令人困惑和沮丧。
发布于 2015-02-04 11:01:32
如图所示,Graphviz2.37在windows上的PATH变量存在问题。我卸载了它,删除了与它相关的环境变量,而是下载并安装了较新的测试版2.39,它现在运行得很好。
发布于 2017-04-20 14:24:32
我在Ubuntu 16.04上也遇到了这个问题。
通过运行以下命令修复
除了我已经执行的pip安装之外。
发布于 2016-08-18 13:46:19
在我的例子中(Win10、Anaconda3、Jupyter notebook)"conda install graphviz"
我必须添加到路径中:C:\Users\username\Anaconda3\Library\bin\graphviz
要修改路径,请转到
Control Panel > System and Security > System > Advanced System Settings > Environment Variables > Path > Edit > New
https://stackoverflow.com/questions/28312534
复制相似问题