为什么pydot无法在Windows 8中findGraphViz的可执行文件?

我在Windows 8中安装了GraphViz 2.32,并将C:\ Program Files(x86)\ Graphviz2.32 \ bin添加到System PATHvariables中。 仍然pydot无法find它的可执行文件。

Traceback (most recent call last): File "<pyshell#26>", line 1, in <module> graph.write_png('example1_graph.png') File "build\bdist.win32\egg\pydot.py", line 1809, in <lambda> lambda path, f=frmt, prog=self.prog : self.write(path, format=f, prog=prog)) File "build\bdist.win32\egg\pydot.py", line 1911, in write dot_fd.write(self.create(prog, format)) File "build\bdist.win32\egg\pydot.py", line 1953, in create 'GraphViz\'s executables not found' ) InvocationException: GraphViz's executables not found 

我发现这个https://code.google.com/p/pydot/issues/detail?id=65,但无法解决问题。

在Mac上, brew install graphviz解决了我的问题。

问题是,如追踪中所示,pydot模块找不到GraphViz的path:

'找不到GraphViz的可执行文件'

我通过将GraphViz bin目录添加到我的计算机的PATH中解决了我的Windows 7机器上的这个问题。 然后重新启动我的Python IDE使用更新的path。

  1. 如果你还没有安装GraphViz(我使用了MSI下载)
  2. 获取gvedit.exe的path(对我来说是“C:\ Program Files(x86)\ Graphviz2.34 \ bin \”)
  3. 将此path添加到计算机的path
  4. 开始设置path的一种方法是点击每个button/菜单选项:开始 – >计算机 – >系统属性 – >高级设置 – >环境variables
  5. 点击编辑用户path
  6. 将此string添加到variables值列表(包括分号)的末尾: C:\ Program Files(x86)\ Graphviz2.34 \ bin
  7. 点击OK
  8. 重新启动你的Python IDE

发生这种情况是因为我在安装pydot之后安装了graphviz。 因此,pydot无法find它。 以正确的顺序重新安装解决了这个问题。

在我的情况下答案从Sadik pydot和graphviz错误:无法导入dot_parser,加载点文件将不可能为我工作在Ubuntu 12.04.5 LTS

sudo apt-get install python-pydot

您需要从Graphviz安装,然后将您安装Graphviz及其bin目录的文件夹的path添加到系统环境path。

将dot.exe添加到您的path。 右键点击我的电脑>高级系统设置>环境variables>高亮'path'>编辑,然后将引号中的所有内容附加到path“; C:\ Program Files(x86)\ Graphviz2.34 \ bin \”,具体取决于您安装的位置Graphviz ofcourse.Then重新启动python shell并键入。

导入pydot pydot.find_graphviz()确保在'bin'之后有一个斜线,所以它从文件夹里面得到了所有的东西,我用斜线试了一下,上面的代码没有返回任何东西,但是在添加斜杠之后它返回了graphviz可执行文件需要和他们的path。

我尝试通过控制面板添加PATH,但重新启动命令提示符也是需要的。 以下内容也适用于在不退出的情况下更新Notebook会话中的path:

 import os os.environ["PATH"] += os.pathsep + 'C:/Program Files (x86)/Graphviz2.38/bin/' 

对于Windows 8.1和Python 2.7,我通过以下步骤解决了问题

1。 下载并安装graphviz-2.38.msi http://www.graphviz.org/pub/graphviz/stable/windows/graphviz-2.38.msi

2。 设置pathvariables

控制面板>系统和安全>系统>高级系统设置>环境variables>path>编辑添加'C:\ Program Files文件(x86)\ Graphviz2.38 \ bin'

在Windows中,即使在安装graphviz-2.38.msi之后,也可以在pydot.py中添加自己的path(在site-package文件夹下find)

  if os.sys.platform == 'win32': # Try and work out the equivalent of "C:\Program Files" on this # machine (might be on drive D:, or in a different language) # if os.environ.has_key('PROGRAMFILES'): # Note, we could also use the win32api to get this # information, but win32api may not be installed. path = os.path.join(os.environ['PROGRAMFILES'], 'ATT', 'GraphViz', 'bin') else: #Just in case, try the default... path = r"C:\PYTHON27\GraphViz\bin" # add here. 

我有这个问题,并注意到它是用两套双引号打印我的PATH。 我通过将以下内容添加到1959行:

 C:\Anaconda\Lib\site-packages\pydot.py self.progs[prog] = os.path.normpath(self.progs[prog][1:-1]) 

显然不是最好的解决办法,但它让我度过了一天。

我也有同样的问题,我终于通过看图书馆来解决它。

该库认为将path设置为C:\ Program Files \ ATT \ Graphviz \ bin,但默认情况下,Graphviz安装到正在接受32位准则的C:\ Program Files(x86)\ Graphviz ,因此pydot无法获得所需path。 只要按照脚本的要求移动目录,你就可以走了。

PS: – 考虑对环境variables进行等同的更改。

PSS: – 同时检查Graphviz是直接在Program Files(x86)下还是在ATT下。

对我来说:(Win10,Anaconda3)确保你已经完成了“conda install graphviz”

我必须添加到PATH:C:\ Users \ username \ Anaconda3 \ Library \ bin \ graphviz

要修改PATH,请进入控制面板>系统和安全>系统>高级系统设置>环境variables>path>编辑>新build

请确保在此之后重新启动您的IDE。 它应该工作