Windows未解决:graph.view():make sure the Graphviz executables are on your systems‘ PATH

import graphviz
from sklearn import tree
import joblib

When I run the above code, VS code reported an error in the first line and could not be imported.
Insert picture description here

pip install

So I guessed that the mechanism must not be installed, so I thought about it

pip install graphviz

Collecting graphviz
  Downloading graphviz-0.14.1-py2.py3-none-any.whl (18 kB)
Installing collected packages: graphviz
Successfully installed graphviz-0.14.1

It was so fast, but when it ran again, there was an error in the title.
Insert picture description here
So Bing searched, this thing requires software installation instead of pip installation,
and then first withdraw the pip installation.pip uninstall graphviz

Graphviz official website download

Official address : https://graphviz.org/download/
Download address : https://www2.graphviz.org/Packages/stable/windows/10/cmake/Release/x64/ When
Insert picture description here
downloading, you can choose to add system variables or Personal variables, here I chose personal variables. After
Insert picture description here
installation, I told me that the addition failed.
Insert picture description here
So I manually added
D:\Program Files\Graphviz 2.44.1\bin
D:\Program Files\Graphviz 2.44.1\bin to the system environment variables. \dot.exe is
confirmed and run in cmd dot -v(the first time there is no response and prompt me to run dot -c)
Insert picture description here
Insert picture description here

According to other posts, the above results show that I have successfully installed.

When I restarted and ran the above program again, the error No module named'graphviz' still appeared. . So I used pip to install it and reported such an error, but the restart did not solve it. . . So I reinstalled, this time I chose to add the path manually, but it didn't happen. .
Hunk

conda installation

conda install python-graphviz

Such a bug appeared after the installation. . . Run still will report errors
Insert picture description here

At last

There are some methods that have not yet been tried: 1. Install graphviz.msi instead of exe.

References

  • https://graphviz.org/download/
  • https://www2.graphviz.org/Packages/stable/windows/10/cmake/Release/x64/
  • https://blog.csdn.net/c_daofeng/article/details/81077594
  • https://zhuanlan.zhihu.com/p/74796069

Guess you like

Origin blog.csdn.net/weixin_43031092/article/details/108684881