無法使用conda install或pip install,我無法正確安裝和導入graphviz。我在蟒蛇上使用jupyter。Graphviz無法使用conda或pip
conda install -c anaconda graphviz
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-2-0e78fd6401bd> in <module>()
----> 1 import graphviz
2 dot_data = tree.export_graphviz(clf, out_file=None)
3 graph = graphviz.Source(dot_data)
4 graph.render("iris")
ModuleNotFoundError: No module named 'graphviz'
當我安裝使用PIP我能成功地導入,但是當我運行下面的代碼,我得到的是與正在運行時,下列graph.render結束了很長的錯誤消息:
from sklearn.datasets import load_iris
from sklearn import tree
import graphviz
iris = load_iris()
clf = tree.DecisionTreeClassifier()
clf = clf.fit(iris.data, iris.target)
dot_data = tree.export_graphviz(clf, out_file=None)
graph = graphviz.Source(dot_data)
graph.render("iris")
以下是一個長錯誤信息的結尾:
ExecutableNotFound: failed to execute ['dot', '-Tpdf', '-O', 'iris'], make sure the Graphviz executables are on your systems' PATH
我有graphviz文件夾在PATH中的目錄。
任何人有一個想法我做錯了什麼?