解决绘制theano图形时出现的`Runtime Error: Failed to import pydot’错误
来源:互联网 发布:妩媚知乎 编辑:程序博客网 时间:2024/06/05 10:12
错误信息
当我在练习theano官方例程时,遇到的一个错误。
根据报错信息,可以判断出在代码执行pydotprint函数时需要依赖pydot和graphviz的python模块。但是,我使用pip list查看,发现已经安装了pydot和graphviz的程序包。单独执行“import pydot”时也没有报错。这让我很困惑。
分析错误
于是,我开始在网上google错误信息。在github的一个issue中,我找到了线索。虽然之前安装了graphviz的python 模块,但是此模块只是一个python接口,其核心库和程序并没有随着一起安装,需要从Graphviz的网站上下载对应的安装文件安装,这在graphviz模块所在的pypi上也有说明,只是之前被忽略了。
To render the generated DOT source code, you also need to install Graphviz.
Make sure that the directory containing the dot executable is on your systems’ path.
解决方案
于是总结解决方案如下:
1. 安装c编译的Graphviz,并把bin文件夹所在的目录添加到系统环境变量PATH中
2. 使用pip安装pydot和graphviz
3. 验证pydot是否能够链接Graphviz的二进制文件
import pydotprint pydot.find_graphviz()
如果链接成功,则会打印类似如下的结果
绘制Theano Graph
该错误解决后就可以可视化theano的graph了。
执行如下的toy code:
import theanoa = theano.tensor.vector()out = a + a**10f = theano.function([a], out)theano.printing.pydotprint(f, outfile = “f_optimized.png”, var_with_name_simple = True)
然后就可得到打印出的graph了。
0 0
- 解决绘制theano图形时出现的`Runtime Error: Failed to import pydot’错误
- 使用theano时,“Runtime Error: Failed to import pydot”错误
- Failed to import pydot
- Failed to import pydot 和graphviz error: (2, 'RegOpenKeyEx',错误总结
- 解决import theano的错误
- Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work.
- ImportError: Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work.
- Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work.
- Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work.
- 解决在启动tornado仿真器出现的错误:error :simulator failed to initialize before timeout
- Failed to import pydot. You must install pydot and graphviz...-keras使用pydot出错(ubuntu16.04)
- 解决IE出现Runtime Error Iexplore.exe的错误
- 解决mindmanager2012打开文件出现runtime error错误的方法
- theano 0.8与pydot、graphziv的冲突解决
- Android sutdio Error:Failed to crunch file 错误的解决
- 导入Theano警告解决:failed to import scipy.linalg.blas, and theano flag blas.ldflags is empty
- 解决安装rails时出现 ERROR: Failed to build gem native extension. 的问题
- 调用flask-SQLAlchemy出现 import error 错误时的解决办法
- Bash读取文件每一行内容
- probability
- Android工具类系列-KeyBoardUtil
- 首次接触CefSharp
- 设计模式(全)
- 解决绘制theano图形时出现的`Runtime Error: Failed to import pydot’错误
- 栈的静态顺序存储表示
- Dataguard Switch Over切换演练步骤
- 我的shiro之旅-realm
- 第13周 阅读程序2-(3)交通工具类之纯虚函数
- c语言常量的使用,define const等等
- NGUI OnChange Event
- 机制而非策略
- 对象