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.
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.
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
downloading, you can choose to add system variables or Personal variables, here I chose personal variables. After
installation, I told me that the addition failed.
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)
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
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