keras使用pydot画图的问题
Posted andy-0212
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了keras使用pydot画图的问题相关的知识,希望对你有一定的参考价值。
from keras.utils import plot_model plot_model(model, to_file="model.png", show_shapes=True, show_layer_names=True)
上面代码执行处做,Assertion Error
解决方案:
This may help for someone who is looking for For Anaconda on Windows 10 64 Bit, Environment: Windows 10 64 Bit, Python 3.5.2, Anaconda 4.2.0 (64-bit)
前三部分可能不需要:
- Download "graphviz-2.38.msi" from https://graphviz.gitlab.io/_pages/Download/Download_windows.html
- Execute the "graphviz-2.38.msi" file
- Add the graphviz bin folder to the PATH system environment variable (Example: "C:Graphviz2.38in")
- Go to Anaconda Prompt using start menu (Make sure to right click and select "Run as Administrator". We may get permission issues if Prompt as not opened as Administrator)
- Execute the command: conda install graphviz
- Execute the command: pip install git+https://github.com/nlhepler/pydot.git
- Execute the command "conda list" and make sure pydot and graphviz modules are listed.
- go to python console, run following codes to check.
import pydot pydot.find_graphviz()
should show:
{‘dot‘: ‘C:\ProgramData\Anaconda3\Library\bin\graphviz\dot.exe‘, ‘twopi‘: ‘C:\ProgramData\Anaconda3\Library\bin\graphviz\twopi.exe‘, ‘neato‘: ‘C:\ProgramData\Anaconda3\Library\bin\graphviz\neato.exe‘, ‘circo‘: ‘C:\ProgramData\Anaconda3\Library\bin\graphviz\circo.exe‘, ‘fdp‘: ‘C:\ProgramData\Anaconda3\Library\bin\graphviz\fdp.exe‘, ‘sfdp‘: ‘C:\ProgramData\Anaconda3\Library\bin\graphviz\sfdp.exe‘}
以上是关于keras使用pydot画图的问题的主要内容,如果未能解决你的问题,请参考以下文章
keras绘图之pydot和graphviz的导入( pydot` failed to call GraphViz)
ImportError: 无法导入 pydot。您必须安装 pydot 和 graphviz 才能使 `pydotprint` 工作