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

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

问题描述

我在 Windows 7 上运行 Python3.4.我正在尝试将 Python 接口用于 graphviz.这是我打算运行的脚本:

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

现在我确定我已经正确安装了正确的依赖项.我首先尝试设置正确的环境变量.graphviz 可执行文件位于 C:Program Files (x86)Graphviz2.37in,所以我转到了环境变量部分.有两个部分:用户变量和系统变量.在系统变量下,我点击了 Path,然后点击了 Edit 并添加了 ;C:Program Files (x86)Graphviz2.37in 到字符串的结尾并保存.这并没有清除错误.

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.37in 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.37in to the end of the string and saved. This didn't clear the error.

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

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

我已经尝试了几个小时来解决这个问题,整个 PATH 变量的事情只是令人困惑和令人沮丧.

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

推荐答案

正如它所显示的那样,Graphviz2.37 在 Windows 上的 PATH 变量存在问题.我卸载了它,删除了与之关联的环境变量,而是下载并安装了较新的 Beta 版 2.39,现在它就像一个魅力.

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天全站免登陆