Tôi đã cố gắng làm cho các gói này hoạt động khá lâu rồi nhưng không thành công. Về cơ bản lỗi là GraphViz's Executables not found
BIÊN TẬP. Tôi đã không đăng một thiết bị đầu cuối log với lỗi ban đầu. Hiện tại tôi đang sử dụng Ubuntu vì vậy tôi sẽ không thể lặp lại chính xác lỗi mà tôi đã gặp phải trong quá khứ (một năm trước, rất xa trong quá khứ. ). Tuy nhiên, tôi đã gặp lỗi tương tự --- nếu không muốn nói là giống --- trong thiết lập hiện tại của mình; . Lỗi dường như đến từ các dòng được mô tả trong câu trả lời của @张乾元 Traceback (most recent call last):
File "example.py", line 49, in
Image(graph.create_png())
File "/home/philippe/.local/lib/python3.6/site-packages/pydotplus/graphviz.py", line 1797, in
lambda f=frmt, prog=self.prog: self.create(format=f, prog=prog)
File "/home/philippe/.local/lib/python3.6/site-packages/pydotplus/graphviz.py", line 1960, in create
'GraphViz\'s executables not found')
pydotplus.graphviz.InvocationException: GraphViz's executables not found
Tôi đã thử cài đặt GraphViz bằng 2 cách khác nhau. qua pip install graphviz và qua gói .msi (và cũng đã thử cài đặt pydot , Traceback (most recent call last):
File "example.py", line 49, in
Image(graph.create_png())
File "/home/philippe/.local/lib/python3.6/site-packages/pydotplus/graphviz.py", line 1797, in
lambda f=frmt, prog=self.prog: self.create(format=f, prog=prog)
File "/home/philippe/.local/lib/python3.6/site-packages/pydotplus/graphviz.py", line 1960, in create
'GraphViz\'s executables not found')
pydotplus.graphviz.InvocationException: GraphViz's executables not found
0 và Traceback (most recent call last):
File "example.py", line 49, in
Image(graph.create_png())
File "/home/philippe/.local/lib/python3.6/site-packages/pydotplus/graphviz.py", line 1797, in
lambda f=frmt, prog=self.prog: self.create(format=f, prog=prog)
File "/home/philippe/.local/lib/python3.6/site-packages/pydotplus/graphviz.py", line 1960, in create
'GraphViz\'s executables not found')
pydotplus.graphviz.InvocationException: GraphViz's executables not found
1 theo nhiều thứ tự khác nhau)Mã tôi đang cố chạy chỉ đơn giản là một trình chuyển đổi Traceback (most recent call last):
File "example.py", line 49, in
Image(graph.create_png())
File "/home/philippe/.local/lib/python3.6/site-packages/pydotplus/graphviz.py", line 1797, in
lambda f=frmt, prog=self.prog: self.create(format=f, prog=prog)
File "/home/philippe/.local/lib/python3.6/site-packages/pydotplus/graphviz.py", line 1960, in create
'GraphViz\'s executables not found')
pydotplus.graphviz.InvocationException: GraphViz's executables not found
2 cho Bộ dữ liệu Irisfrom sklearn.tree import DecisionTreeClassifier
import sklearn.datasets as datasets
from sklearn.externals.six import StringIO
from sklearn.tree import export_graphviz
import pandas as pd
import pydotplus
from IPython.display import Image
iris = datasets.load_iris()
df = pd.DataFrame(iris.data, columns = iris.feature_names)
y = iris.target
dtree = DecisionTreeClassifier()
dtree.fit(df,y)
dot_data = StringIO()
export_graphviz(
dtree,
out_file = dot_data,
filled = True,
rounded = True,
special_characters = True
)
graph_1 = pydotplus.graph_from_dot_data(dot_data.getvalue())
Image(graph_1.create_png())
Trong Traceback (most recent call last):
File "example.py", line 49, in
Image(graph.create_png())
File "/home/philippe/.local/lib/python3.6/site-packages/pydotplus/graphviz.py", line 1797, in
lambda f=frmt, prog=self.prog: self.create(format=f, prog=prog)
File "/home/philippe/.local/lib/python3.6/site-packages/pydotplus/graphviz.py", line 1960, in create
'GraphViz\'s executables not found')
pydotplus.graphviz.InvocationException: GraphViz's executables not found
3 và trong Traceback (most recent call last):
File "example.py", line 49, in
Image(graph.create_png())
File "/home/philippe/.local/lib/python3.6/site-packages/pydotplus/graphviz.py", line 1797, in
lambda f=frmt, prog=self.prog: self.create(format=f, prog=prog)
File "/home/philippe/.local/lib/python3.6/site-packages/pydotplus/graphviz.py", line 1960, in create
'GraphViz\'s executables not found')
pydotplus.graphviz.InvocationException: GraphViz's executables not found
4, hệ thống dường như đang tìm kiếm GraphViz bên trong Traceback (most recent call last):
File "example.py", line 49, in
Image(graph.create_png())
File "/home/philippe/.local/lib/python3.6/site-packages/pydotplus/graphviz.py", line 1797, in
lambda f=frmt, prog=self.prog: self.create(format=f, prog=prog)
File "/home/philippe/.local/lib/python3.6/site-packages/pydotplus/graphviz.py", line 1960, in create
'GraphViz\'s executables not found')
pydotplus.graphviz.InvocationException: GraphViz's executables not found
0, vì nó trỏ tới Traceback (most recent call last):
File "example.py", line 49, in
Image(graph.create_png())
File "/home/philippe/.local/lib/python3.6/site-packages/pydotplus/graphviz.py", line 1797, in
lambda f=frmt, prog=self.prog: self.create(format=f, prog=prog)
File "/home/philippe/.local/lib/python3.6/site-packages/pydotplus/graphviz.py", line 1960, in create
'GraphViz\'s executables not found')
pydotplus.graphviz.InvocationException: GraphViz's executables not found
7. Nó không nên là cách khác xung quanh?Cuối cùng, tôi chỉ muốn chỉ ra rằng tôi đã thử thêm đường dẫn của GraphViz vào Traceback (most recent call last):
File "example.py", line 49, in
Image(graph.create_png())
File "/home/philippe/.local/lib/python3.6/site-packages/pydotplus/graphviz.py", line 1797, in
lambda f=frmt, prog=self.prog: self.create(format=f, prog=prog)
File "/home/philippe/.local/lib/python3.6/site-packages/pydotplus/graphviz.py", line 1960, in create
'GraphViz\'s executables not found')
pydotplus.graphviz.InvocationException: GraphViz's executables not found
9 của hệ thống bằng cách sử dụng from sklearn.tree import DecisionTreeClassifier
import sklearn.datasets as datasets
from sklearn.externals.six import StringIO
from sklearn.tree import export_graphviz
import pandas as pd
import pydotplus
from IPython.display import Image
iris = datasets.load_iris()
df = pd.DataFrame(iris.data, columns = iris.feature_names)
y = iris.target
dtree = DecisionTreeClassifier()
dtree.fit(df,y)
dot_data = StringIO()
export_graphviz(
dtree,
out_file = dot_data,
filled = True,
rounded = True,
special_characters = True
)
graph_1 = pydotplus.graph_from_dot_data(dot_data.getvalue())
Image(graph_1.create_png())
0 |