找不到Graphviz的可执行文件(Python 3.4) [英] Graphviz's executables are not found (Python 3.4)

查看:380
本文介绍了找不到Graphviz的可执行文件(Python 3.4)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 7上运行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 中,因此我进入了环境变量"部分.那里有两个部分:用户变量和系统变量.在系统变量"下,单击"路径",然后单击"Edit",然后在字符串的末尾添加; C:\ Program Files(x86)\ Graphviz2.37 \ bin 并保存.这不能清除错误.

然后,按照答案在此处给出我卸载了pydot(实际上我在这里使用pydotplus),然后再次重新安装了它,但仍然没有成功.

我已经尝试了几个小时来解决此问题,而整个PATH变量问题却令人困惑和沮丧.

解决方案

看起来,Graphviz2.37在Windows上的PATH变量存在问题.我卸载了它,删除了与之关联的环境变量,而是下载并安装了更新的Beta版本2.39,现在它像一个魅力一样工作.

I am running Python3.4 on Windows 7. I am trying to use the Python interface for graphviz. This is a script I intend to run:

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)

I get the following error at runtime:

RuntimeError: failed to execute ['dot', '-Tpdf', '-O', 'test-output/round-table.gv'], make sure the Graphviz executables are on your systems' path

Now I am sure I have properly installed the correct dependencies. I first tried to set the correct environment variables. The graphviz executables are located at C:\Program Files (x86)\Graphviz2.37\bin so I went to the Environment Variables section. There are two sections there: User Variables and System Variables. Under System Variables I clicked on Path and then clicked Edit and added ;C:\Program Files (x86)\Graphviz2.37\bin to the end of the string and saved. This didn't clear the error.

Then, following the answer given here I uninstalled pydot (actually I use pydotplus here) and re-installed it again, but still no success.

I have been trying for hours to fix this and the whole PATH variable thing is just confusing and frustrating.

解决方案

As it appears, Graphviz2.37 is known to have problems with the PATH variable on windows. I uninstalled it, removed the environment variables associated with it and instead downloaded and installed the newer beta version 2.39 and it now works like a charm.

这篇关于找不到Graphviz的可执行文件(Python 3.4)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆