为什么pydot找不到GraphViz';Windows 8中的可执行文件?
我在Windows 8中安装了GraphViz 2.32,并将C:\Program Files(x86)\GraphViz 2.32\bin添加到系统路径变量中。pydot仍然无法找到其可执行文件为什么pydot找不到GraphViz';Windows 8中的可执行文件?,graphviz,scikit-learn,pygraphviz,pydot,Graphviz,Scikit Learn,Pygraphviz,Pydot,我在Windows 8中安装了GraphViz 2.32,并将C:\Program Files(x86)\GraphViz 2.32\bin添加到系统路径变量中。pydot仍然无法找到其可执行文件 Traceback (most recent call last): File "<pyshell#26>", line 1, in <module> graph.write_png('example1_graph.png') File "build\bdist
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
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
graph.write\u png('example1\u graph.png')
文件“build\bdist.win32\egg\pydot.py”,第1809行,在
lambda路径,f=frmt,prog=self.prog:self.write(路径,格式=f,prog=prog))
写入文件“build\bdist.win32\egg\pydot.py”,第1911行
dot_fd.write(自创建(程序,格式))
文件“build\bdist.win32\egg\pydot.py”,第1953行,在create中
'未找到GraphViz的可执行文件')
调用异常:找不到GraphViz的可执行文件
我发现了这一点,但无法解决问题。这是因为我在安装pydot之后安装了graphviz。因此,派多特无法找到它。按正确的顺序重新安装解决了问题。将dot.exe添加到路径中。 右键单击我的电脑>高级系统设置>环境变量>强光“路径>编辑” 然后根据Graphviz的安装位置,将引号中的所有内容附加到路径“C:\Program Files(x86)\Graphviz 2.34\bin\”中。然后重新启动python shell并键入 导入pydot pydot.find_graphviz() 确保“bin”后面有一个斜杠,这样它就可以从文件夹中获取所有内容。我试着去掉斜杠,上面的代码没有返回任何内容,但是添加斜杠后,它返回了所需的graphviz可执行文件及其路径
我有这个问题,注意到它用两组双引号打印我的路径。我通过在1959行中添加以下内容来解决此问题:
C:\Anaconda\Lib\site-packages\pydot.py
self.progs[prog] = os.path.normpath(self.progs[prog][1:-1])
显然不是最好的解决方案,但它让我度过了这一天。问题是pydot模块没有找到GraphViz的路径,如回溯中所示: “找不到GraphViz的可执行文件” 我在Windows7上解决了这个问题,将GraphViz bin目录添加到我的计算机路径中。然后重新启动python IDE以使用更新的路径
您需要从安装,然后只需将安装Graphviz的文件夹路径及其bin目录添加到系统环境路径。在Mac上brew安装Graphviz为我解决了这个问题。在我的例子中,来自Sadik的答案 在Ubuntu 12.04.5 LTS上为我工作
sudo apt get install python pydot
我尝试通过控制面板添加路径,但也需要重新启动命令提示符。以下内容也适用于在不退出的情况下更新笔记本会话中的路径:
import os
os.environ["PATH"] += os.pathsep + 'C:/Program Files (x86)/Graphviz2.38/bin/'
在Windows中,即使安装了graphviz-2.38.msi,也可以在pydot.py中添加自己的路径(可在site package文件夹下找到) 我也有同样的问题,我最终通过查看图书馆解决了这个问题。 库考虑将路径设置为C:\Program Files\ATT\Graphviz\bin,但默认情况下,Graphviz安装到C:\Program Files(x86)\Graphviz,并符合32位标准,因此pydot无法获取所需路径。 只要按照脚本的要求移动目录,就可以了
S.:-考虑对EnrimNETs变量进行等价的改变。
另请注意:-还要检查Graphviz是否直接位于程序文件(x86)或附件下。对于我:(Win10,Anaconda3) 确保您已完成“conda安装graphviz” 我必须添加到路径:C:\Users\username\Anaconda3\Library\bin\graphviz 要修改路径,请转到控制面板>系统和安全>系统>高级系统设置>环境变量>路径>编辑>新建 确保在此之后重新启动IDE。对于Windows8.1和Python2.7,它应该可以工作,我通过以下步骤修复了这个问题 一,。下载并安装graphviz-2.38.msi 二,。设置路径变量 控制面板>系统和安全>系统>高级系统设置>环境变量>路径>编辑 添加“C:\ProgramFiles(x86)\Graphviz2.38\bin”
您可以在此处查看文件:尝试了所有解决方案/发布/博客中描述的所有安装顺序,最后意识到anaconda无法读取环境变量。关闭了蟒蛇和斯皮德。然后在管理员模式下打开Anaconda(在Windows 64位操作系统机器上),然后打开Spyder。脚本在PYDOT调用中运行良好。我没有使用windows机器,我在linux平台上。在使用python包pyAgrum绘制贝叶斯网络的过程中,我遇到了这个未发现的可执行文件问题。Pyagram使用graphviz绘制网络。我在python 3.6.4环境中使用anaconda平台安装了Pyagram和graphviz(即,
conda安装
)
我在/conda/envs//bin
目录中找到了可执行文件。所以,这只是让我的笔记本内核找到它们的问题
如果您导入操作系统
,请使用命令os.environ['PATH'].split(os.pathsep)
查看其中的可执行路径
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.
if prog not in self.progs:
raise InvocationException(
'GraphViz\'s executable "%s" not found' % prog)
if not os.path.exists(self.progs[prog]) or \
not os.path.isfile(self.progs[prog]):
raise InvocationException(
'GraphViz\'s executable "{}" is not'
' a file or doesn\'t exist'.format(self.progs[prog])
)
if prog not in self.progs:
raise InvocationException(
'GraphViz\'s executable "%s" not found' % prog)
self.progs[prog] = "C:/Program Files (x86)/Graphviz2.38/bin/gvedit.exe"
if not os.path.exists(self.progs[prog]) or \
not os.path.isfile(self.progs[prog]):
raise InvocationException(
'GraphViz\'s executable "{}" is not'
' a file or doesn\'t exist'.format(self.progs[prog])
)
elif os.path.exists(os.path.join(path, prg + '.exe')):
if was_quoted:
progs[prg] = '"' + os.path.join(path, prg + '.exe') + '"'
else:
progs[prg] = os.path.join(path, prg + '.exe')
elif os.path.exists(os.path.join(path, prg + '.bat')):
if was_quoted:
progs[prg] = '"' + os.path.join(path, prg + '.bat') + '"'
else:
progs[prg] = os.path.join(path, prg + '.bat')
def get_executable_extension():
# type: () -> str
if is_windows():
return '.bat' if is_anacoda() else '.exe'
else:
return ''
def get_executable_extension():
# type: () -> str
if is_windows():
return '.exe'
else:
return ''
conda install python-graphviz
conda install pydot
conda install pydotplus
import os
os.environ["PATH"] += os.pathsep + 'C:/Program Files (x86)/Graphviz2.38/bin/'