'Failed to import pydot. You must `pip install pydot` and install graphviz
import pydot
import graphviz
from keras.utils import plot_model
plot_model(model, to_file='model.png')
conda install -c https://conda.binstar.org/t/TOKEN/j14r pydot
conda install -c https://conda.binstar.org/t/TOKEN/j14r graphviz
pydot
I used pip uninstall
on all related packages, then:
pip install pydot
pip install pydotplus
pip install graphviz
pip install pydot-ng
Then:
- Download and install graphviz binaries from here
- Add path to graphviz bin folder in system PATH
Using TensorFlow 2.3.0 on Windows 10 without Anaconda, the following (finally) worked for me:
- Install Graphviz 32 bit (64 bit didn't work)
- Add Graphviz path
C:\Program Files (x86)\Graphviz\bin
to system's and user'sPATH
environment variables - Install pydot-ng which is the preferred pydot library used by TensorFlow 2.3.0
import keras
import pydot
import pydotplus
from pydotplus import graphviz
from keras.utils.vis_utils import plot_model
from keras.utils.vis_utils import model_to_dot
keras.utils.vis_utils.pydot = pydot
REF
https://stackoverflow.com/questions/47605558/importerror-failed-to-import-pydot-you-must-install-pydot-and-graphviz-for-py
import tensorflow as tf input = tf.keras.Input(shape=(100,), dtype='int32', name='input') x = tf.keras.layers.Embedding(output_dim=512, input_dim=1000, input_length=100)(input) x = tf.keras.layers.LSTM(32)(x) x = tf.keras.layers.Dense(64, activation='relu')(x) output = tf.keras.layers.Dense(1, activation='sigmoid', name='output')(x) model = tf.keras.Model(inputs=[input], outputs=[output])
REF
https://www.gcptutorials.com/article/how-to-plot-model-architecture-with-tf.keras.utils
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 园子的第一款AI主题卫衣上架——"HELLO! HOW CAN I ASSIST YOU TODAY
2020-03-05 根据三条边的长度在线生成三角形(generate triangles by edge lengths)
2015-03-05 bwa的使用方法
2015-03-05 samtools常用命令详解
2015-03-05 linux下bwa和samtools的安装与使用