Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work.

Graphviz的可执行文件

http://www.graphviz.org/Download_windows.PHP


参考:http://blog.csdn.net/u014749291/article/details/54891087?utm_source=itdadao&utm_medium=referral

windows平台下,pip安装pydot和graphviz:

pip install pygot

pip install graphviz

测试时:

import pydot

print pydot.find_graphviz()

结果返回None

绘图运行时还出现如下错误:

raise ImportError :Failed to import pydot. You must install pydot  and graphviz for `pydotprint` to work.

归根到底就是,pydot找不到Graphviz的可执行文件,包括dot.exe, twopi.exe, neato.exe.

这个在pydot安装目录的_init_.py文件中有说明:

Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work._第1张图片

找到graphviz安装目录,发现根本没有这三个exe文件,原因就是windows平台下不能用pip安装graphviz。

于是 http://www.graphviz.org/Download_windows.PHP 处下载graphviz的msi或者zip文件,安装后,在path添加环境变量指向graphviz的bin目录(该目录下有那几个exe文件),然后重新打开Python环境测试,出现:

Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work._第2张图片

表示安装成功!


参考文献:

http://blog.csdn.NET/wangjian1204/article/details/50346457

http://blog.csdn.net/u011274209/article/details/52892255



http://www.bkjia.com/Androidjc/901561.html

配置pydot环境,pydot环境


第一次配置pydot环境,过程还是比较曲折,看来对这种模式还不是很熟悉。断断续续弄了两天弄好了。都是些小要求,小细节问题。

安装的顺序也很重要:

1、安装python-2.7.8.amd64.msi, 选择only for me,否则后面pyparsing解析不出路径;

2、在path中设置 python的路径 如, D:\python27

3、安装graphviz-2.26.3.msi, 选择for everyone 否则会出错;

4、在path中设置graphviz路径,否则pydot解析不出来, 如D:\graphviz-2.26.3\bin

5、安装pyparsing-1.5.7.win32-py2.7.exe;

6、解压缩pydot-1.0.28,到路径中去, 直接运行命令:   python setup.py install。安装成功

7、写个test测试一下

import pydot
edg = [(1,2), (1,3), (1,4) , (3,4)]
g=pydot.graph_from_edges(edg)
g.write_jpeg('graph.jpg', prog = 'dot')

Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work._第3张图片


ok,配置成功!

所有配置文件以及测试文件:http://download.csdn.net/detail/ls1160/8088591

参考:

http://blog.csdn.net/tjhd1989/article/details/8954062
http://www.cnblogs.com/min0208/archive/2012/05/24/2515584.html



你可能感兴趣的:(python,tensorflow)