簡體   English   中英

python-theano打印pydotprint-運行時錯誤:無法導入pydot

[英]python - theano printing pydotprint - runtime error: failed to import pydot

我正在嘗試運行這個腳本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 或 pydot pydot-ng 用於“ 782 ” pydotprint工作。”, --> 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

錯誤消息在這里提供了線索: dot.exe中缺少dot.exe ( C:/Anaconda/Library/bin )。 補充@Ioannis 的答案,您必須安裝 GraphViz 可執行文件(通過 conda) dot.exe在您的路徑中獲取dot.exe

就我而言,在安裝 GraphViz ( conda install GraphViz ) 后,我嘗試使用最新的 pydot ( pip install pydot ) 並解決了錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM