[英]Pydotplus in Python
I am having a boring day thanks to be not solving a difficult problem, which is about pydotplus in python.由于没有解决一个难题,这是关于 python 中的 pydotplus 的难题,我度过了无聊的一天。
First of all here is my code:首先这里是我的代码:
from ipywidgets import Image
from io import StringIO
import pydotplus
from sklearn.tree import export_graphviz
d_tree99 = rf.estimators_[99]
dot_data = StringIO()
export_graphviz(d_tree99, feature_names = X.columns,
out_file = dot_data, filled = True, rounded=True)
graph = pydotplus.graph_from_dot_data(dot_data.getvalue())
Image(value = graph.create_png())
I debugged the code in both in Jupyter Notebook, and in Visual Studio Code Python Extension.我在 Jupyter Notebook 和 Visual Studio Code Python Extension 中调试了代码。
And I got the below error in both of them:我在他们两个中都得到了以下错误:
InvocationException
调用异常
Traceback (most recent call last) in () 9 out_file = dot_data, filled = True, rounded=True) 10 graph = pydotplus.graph_from_dot_data(dot_data.getvalue()) ---> 11 Image(value = graph.create_png())回溯(最近一次调用最后一次) in () 9 out_file = dot_data, 填充 = True, rounded=True) 10 graph = pydotplus.graph_from_dot_data(dot_data.getvalue()) ---> 11 Image(value = graph.create_png() )
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\pydotplus\graphviz.py in (f, prog) 1789 self.
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\pydotplus\graphviz.py in (f, prog) 1789 self. setattr ( 1790 'create_' + frmt, -> 1791 lambda f=frmt, prog=self.prog: self.create(format=f, prog=prog) 1792 ) 1793 f = self.
setattr (1790 'create_' + frmt, -> 1791 lambda f=frmt, prog=self.prog: self.create(format=f, prog=prog) 1792) 1793 f = self. dict ['create_' + frmt]
dict ['create_' + frmt]
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\pydotplus\graphviz.py in create(self, prog, format) 2024 raise InvocationException( 2025 'Program terminated with status: %d. stderr follows: %s' % ( -> 2026 status, stderr_output)) 2027 elif stderr_output: 2028 print(stderr_output)
C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\pydotplus\graphviz.py in create(self, prog, format) 2024 raise InvocationException( 2025 '程序以状态终止:%d .stderr 如下:%s' % ( -> 2026 status, stderr_output)) 2027 elif stderr_output: 2028 print(stderr_output)
InvocationException: Program terminated with status: 1. stderr follows: 'C:\Program' is not recognized as an internal or external command, operable program or batch file.
InvocationException:程序以状态终止:1. 标准错误如下:'C:\Program' 不被识别为内部或外部命令、可运行程序或批处理文件。
Could you please inform me why i got this error.你能告诉我为什么我得到这个错误。 And could you please enlighten me about solving this error?
你能告诉我解决这个错误吗? This is very important for me.
这对我来说非常重要。
Thanks a lot非常感谢
If you have a path that contains spaces, you need to quote the path so it gets interpreted correctly by the command line interpreter.如果您的路径包含空格,则需要引用路径,以便命令行解释器正确解释它。 This did (for some reason) not happen in your program.
这确实(由于某种原因)在您的程序中没有发生。 I assume that the libraries you are using are not quoting the path correctly.
我假设您使用的库没有正确引用路径。
If that is the case, you have two options:如果是这种情况,您有两种选择:
Related : Command Prompt Error 'C:\Program' is not recognized as an internal or external command, operable program or batch file相关:命令提示错误“C:\Program”不被识别为内部或外部命令、可运行程序或批处理文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.