display Image graph.create_png InvocationException: GraphViz‘s executables not found

import pydotplus
操作环境:

MacBook Pro,

Python3.6.5,

Jupyter Notebook,

系统版本:Mac OS Big Sur

from IPython.display import display,Image

dot_data = tree.export_graphviz(clf,
                     out_file=None,
                      feature_names=iris_feature_name,
                      class_names = iris_target_name,
                      filled = True,
                      rounded = True
                     )

graph = pydotplus.graph_from_dot_data(dot_data)

display(Image(graph.create_png()))

执行最后一行代码是 提示

InvocationException: GraphViz's executables not found

很明显,需要安装graphviz

首先确保brew安装,brew install graphviz

附:

Mac安装brew

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

开始执行Brew自动安装程序

[cunkai.wang@foxmail.com]

['2021-06-06 11:19:39']['11.4']

https://zhuanlan.zhihu.com/p/111014448

请选择一个下载镜像,例如中科大,输入1回车。

源有时候不稳定,如果git克隆报错重新运行脚本选择源。cask非必须,有部分人需要。

1、中科大下载源 2、清华大学下载源 3、北京外国语大学下载源 4、腾讯下载源(不推荐) 5、阿里巴巴下载源(不推荐 缺少cask源)

 

选择2 网络问题导致失败

选择3 后续安装软件(brew install )容易异常

==> Installing dependencies for git: pcre2

==> Installing git dependency: pcre2

==> Pouring pcre2-10.37.big_sur.bottle.tar.gz

tar: Error opening archive: Failed to open '/Users/aimmon/Library/Caches/Homebrew/downloads/a4ffef1d16f544b1487c843bbf93381600366d3c365c37befc664cba85dfa603--pcre2-10.37.big_sur.bottle.tar.gz'

Error: Failure while executing; `tar --extract --no-same-owner --file /Users/aimmon/Library/Caches/Homebrew/downloads/a4ffef1d16f544b1487c843bbf93381600366d3c365c37befc664cba85dfa603--pcre2-10.37.big_sur.bottle.tar.gz --directory /private/tmp/d20210606-18464-1u8c5v5` exited with 1. Here's the output:

选择1(个人推荐)

最后运行成功

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

aimmon

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值