mxnet报graphviz.backend.ExecutableNotFound: failed to execute

错误描述

graphviz.backend.ExecutableNotFound: failed to execute ['dot', '-Tpdf', '-O', 'resnet-18'], make sure the Graphviz executables are on your systems' PATH


原因介绍

在使用mxnet通过json文件来保存模型的计算图结构时报错,保存代码如下

sym,arg_params,aux_params = mx.model.load_checkpoint("resnet-18",0)
a = mx.viz.plot_network(sym, shape={"data": (1, 3, 224, 224)}, node_attrs={"shape": 'rect', "fixedsize": 'false'})
a.render('resnet-18')

环境介绍

  • 系统环境:windows10
  • python版本:3.6.8
  • mxnet版本:1.4.1

解决办法

  • 先安装graphviz软件,已经安装请忽略

Ubuntu系统安装命令

sudo apt-get install graphviz

Mac安装命令

 brew install graphviz

windows系统安装

graphviz下载地址:https://graphviz.gitlab.io/_pages/Download/Download_windows.html

从上面的地址中下载msi文件进行安装

mxnet报graphviz.backend.ExecutableNotFound: failed to execute_第1张图片

  1. 安装graphviz的msi软件包
  2. 将graphviz的bin路径添加到系统的path环境变量中
  3. 如果添加到path环境变量中之后还是没用,在python文件中添加下面两句代码
import os
os.environ["PATH"] += os.pathsep + 'D:/Program Files (x86)/Graphviz2.38/bin/'

参考:https://stackoverflow.com/questions/35064304/runtimeerror-make-sure-the-graphviz-executables-are-on-your-systems-path-aft

你可能感兴趣的:(mxnet修炼之路,mxnet)