2016-10-25 6 views
0

Я пытаюсь узнать науку данных в Интернете, и когда я бегу сценарий одного из видео Google, я получаю эту ошибку:Graphviz исполняемый не нашел

File "/documents/testpython.py", line 547, in <module> 
graph.write_pdf("iris pdf") 

File "/anaconda/lib/python3.5/site-packages/pydotplus/graphviz.py", line 1810, in <lambda> 
prog=self.prog: self.write(path, format=f, prog=prog) 

File "/anaconda/lib/python3.5/site-packages/pydotplus/graphviz.py", line 1918, in write 
fobj.write(self.create(prog, format)) 

File "/anaconda/lib/python3.5/site-packages/pydotplus/graphviz.py", line 1960, in create 
'GraphViz\'s executables not found') 

pydotplus.graphviz.InvocationException: GraphViz's executables not found 

Вот сценарий:

from sklearn.datasets import load_iris 
import numpy as np 
from sklearn import tree 

iris = load_iris() 
test_idx = [0,50,100] 

train_target = np.delete(iris.target, test_idx) 
train_data = np.delete(iris.data, test_idx, axis = 0) 

test_target = iris.target[test_idx] 
test_data = iris.data[test_idx] 

clf = tree.DecisionTreeClassifier() 
clf.fit(train_data, train_target) 

from sklearn.externals.six import StringIO 
import pydotplus 

dot_data = StringIO() 
tree.export_graphviz(clf, out_file=dot_data, feature_names=iris.feature_names, class_names=iris.target_names, filled=True, rounded=True, impurity=False) 
graph = pydotplus.graph_from_dot_data(dot_data.getvalue()) 
graph.write_pdf("iris pdf") 

Если у кого есть какие-либо идеи, я не уверен, если проблема исходит от моей версии питона или библиотеки или что-нибудь еще ...

Благодарности

ответ