本文主要是介绍Jupyter Notebook下graphviz报错 Error: <stdin>: syntax error in line 1 near ‘None‘,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
报错代码:
feature_name = ['酒精','苹果酸','灰','灰的碱性','镁','总酚','类黄酮','非黄烷类酚类','花青素','颜色强度','色调','od280/od315稀释葡萄酒','脯氨酸']import graphviz
dot_data = tree.export_graphviz(clf,out_file= "Tree.dot"
# ,out_file= None,feature_names = feature_name,class_names=["琴酒","雪莉","贝尔摩德"],filled=True,rounded=True)
#不知道为啥会报错
graph = graphviz.Source(dot_data)
grap
报错信息:
CalledProcessError: Command ‘[‘dot.bat’, ‘-Kdot’, ‘-Tsvg’]’ returned non-zero exit status 1. [stderr: b"Error: : syntax error in line 1 near ‘None’\r\n"]
<graphviz.files.Source at 0x197ab6e2198>
改正:
在参数列表添加 out_file=None,报错解决
import graphviz
dot_data = tree.export_graphviz(clf
# ,out_file= "Tree.dot",out_file= None,feature_names = feature_name,class_names=["琴酒","雪莉","贝尔摩德"],filled=True,rounded=True)
graph = graphviz.Source(dot_data)
graph
参考自:https://www.freesion.com/article/32081234868/
这篇关于Jupyter Notebook下graphviz报错 Error: <stdin>: syntax error in line 1 near ‘None‘的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!