Solution to error when using Keras Plot_model function under Mac __ function

Source: Internet
Author: User
Tags keras

Environment: MAC

Using the Keras drawing requires the use of the Plot_model function, the correct usage is as follows:

From keras.utils import Plot_model
plot_model (model,to_file= ' model.png ')

But it's an error.

Keras importerror:failed to import Pydot. You are must install Pydot and Graphviz for ' pydotprint ' to work.

The error says Pydot and Graphviz are not installed, and then run to use PIP to install the discovery or not. Later on the internet to find a lot of data found that the correct approach should be to install Graphviz on the system. The reason is that the previous PIP installed Graphviz is only a convenient Python call interface library, in fact, or to install from the system, here I use the homebrew installation.
Normal installation should be able to run after.

the correct procedure is as follows, each install a run over the test code, do not complain will not have to go down to install.

1. Brew Install Graphviz
2 pip install Pydot
3. Pip Install Graphviz
3. Pip Install pydot_ng
4 pip Insta ll Pydotplus

Test code, no error will indicate that the installation was successful

Import Pydot
Pydot. Dot.create (Pydot. Dot ())

I am here is Apple's Mac environment, Windows is similar, need to install EXE, may also need graphviz to add to the environment variable path. Reference

Https://stackoverflow.com/questions/27666846/pydot-invocationexception-graphvizs-executables-not-found

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.