`pydot` failed to call GraphViz.解决方法

如下所示:

d:\anaconda\envs\tensorflow\lib\site-packages\keras\utils\vis_utils.py in _check_pydot()
     27     except OSError:
     28         raise OSError(
---> 29             '`pydot` failed to call GraphViz.'
     30             'Please install GraphViz (https://www.graphviz.org/) '
     31             'and ensure that its executables are in the $PATH.')

OSError: `pydot` failed to call GraphViz.Please install GraphViz (https://www.graphviz.org/) and ensure that its executables are in the $PATH. 

windows系统下,在 keras里面绘图时,如果没有导入过pydot和 graphviz,在运行时会报告" Failed to import pydot. You must install pydot"类似的错误,并且提示你 pip install pydot,可是 pip install之后,又会提示你找不到 graphviz。
 
然后 pip install graphv后发现没用,网上搜索的解决方案大都是直接官网下载 graphy后并且加入系统path变量,但是最后如果倒霉的话有可能发现还是报同样的错。还是会报告 pydot找不到 graphviz( pydot failed to call Graphviz)
其实是pydot的原因,由于pydot已经停止开发了,pyhn3.5和 python36已经用不起来。解决方案是 

第一步:先卸载掉已经安装的pydot:
     pip uninstall pydot 

第二步:安装pydotplus
     pip install pydotplus 
然后找到 keras里面的 utils\vis_utils.py,把里面的pydot的都替换成 pydotplus

如果上述步骤都完成了还是报刚开的错误的话,那就重新安装一下graphviz,即:#conda install graphviz

 

猜你喜欢

转载自blog.csdn.net/sinat_29217765/article/details/94024519