我正在尝试运行此脚本 https://github.com/dennybritz/nn-theano/blob/master/nn-theano.ipynb它使用 theano 实现神经网络。
一切都很顺利,直到我到达牢房:
theano.printing.pydotprint(forward_prop, var_with_name_simple=True, compact=True, outfile='img/nn-theano-forward_prop.png', format='png')
SVG(theano.printing.pydotprint(forward_prop, var_with_name_simple=True, compact=True, return_image=True, format='svg'))
然后我收到此错误:
RuntimeError Traceback (most recent call last) <ipython-input-11-db44e43f05ee> in <module>() ----> 1 theano.printing.pydotprint(forward_prop, var_with_name_simple=True, compact=True, outfile='img/nn-theano-forward_prop.png', format='png') 2 SVG(theano.printing.pydotprint(forward_prop, var_with_name_simple=True, compact=True, return_image=True, format='svg'))
~\Anaconda3\lib\site-packages\theano\printing.py in pydotprint(fct, outfile, compact, format, with_ids, high_contrast, cond_highlight, colorCodes, max_label_size, scan_graphs, var_with_name_simple, print_output_file, return_image) 781 " and either pydot or pydot-ng for " 782 "
pydotprint
to work.", --> 783 pydot_imported_msg) 784 785 g = pd.Dot()RuntimeError: ('Failed to import pydot. You must install graphviz and either pydot or pydot-ng for `pydotprint` to work.', 'An error happened while importing/trying pydot: (2, \'"dot.exe" not found in path.\', None, 2, None)')
我已经阅读了 Stack 上的其他问题,并尝试通过 https://graphviz.gitlab.io/ 安装 graphviz
我安装了 pydot、pydotplus、graphviz (2.38.0) 和 python-graphviz (0.8.2)。 我正在使用最近更新的 Anaconda Navigator。 Python 3.6.4 Windows 10 32 位。
最佳答案
GraphViz 可执行文件需要位于 $PATH
变量中,pydot
才能找到它们。请参阅:https://stackoverflow.com/a/47209738/1959808
pydotplus
是 pydot
的一个未维护的分支。
关于python - theano 打印 pydotprint - 运行时错误 : failed to import pydot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49771377/