无法使用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中的目录。
任何人有一个想法我做错了什么?