jupyter中使用graphviz


因為想在jupyter中畫決策樹,所以需要使用graphviz

安裝:

1.去官網下msi,安裝

2.配置系統path和用戶path為路徑\bin和路徑\bin\dot.exe

3.cmd中dot -version查看信息,說明配置成功

4.在C:\ProgramData\Anaconda3\Scripts>pip install graphviz

但是在jupyter中使用還會報錯CalledProcessError: Command '['dot', '-Tsvg']' returned non-zero exit status 1. [stderr: b"Error: <stdin>: syntax error in line 1 near 'None'\r\n"],代碼中加上import os
os.environ["PATH"] += os.pathsep + 'E:/Graphviz/bin/'這兩行也沒有用

然后我找解決方案找了兩天

最后

stack overflow上的大佬解決了問題

嗚嗚嗚太感動了,在這

https://stackoverflow.com/questions/54243959/saving-graphviz-decision-tree-plot-using-scikit-learn-decisiontreeclassifier?r=SearchResults

我畫出決策樹了終於

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM