Graphviz. Backend. Executablenotfound: failed to execute ‘dot’ Python uses graphviz to solve drawing errors

Solve the problem of drawing error with Python graphviz package

Finally, you need to restart pycharm to draw normally.

1. Error reporting

The error information is as follows:

graphviz.backend.ExecutableNotFound: failed to execute 'dot'make sure the Graphviz executables are on your systems' PATH

2. Determine variable type

The program prints variable data types plotted using graphviz

The print result shows that the type of drawing you want to draw is & lt; class ‘graphviz.dot.Digraph’>

3. Settle

3.1 Windows System Download and install graphviz

Graphviz download link to find the appropriate number of bits to download. Run the MSI file and install graphviz

3.2 configuring environment variables

Find the bin folder under the installation directory, copy the path, such as “D: \ software \ graphviz \ bin”, configure the system environment variable path, and create a new record for it. The content is the path copied in the previous step, as shown in Figure:

3.3 restart pycharm

After restart, use the. View () command to draw and display the image normally

. view() parameter explanation:
filename: picture name. The default is digraphv.gv. You can specify
Directory: picture saving path. The default is to save in the current path. You can specify

Run the code and view the image

Read More: