Importing theano: AttributeError: 'module' object has no attribute 'find_graphviz'

Importing theano: AttributeError: 'module' object has no attribute 'find_graphviz'

当我在 Python 中 运行 import theano 时,我收到以下错误消息:

Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import theano
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/theano/__init__.py", line 74, in <module>
    from theano.printing import pprint, pp
  File "/usr/local/lib/python2.7/dist-packages/theano/printing.py", line 35, in <module>
    if pd.find_graphviz():
AttributeError: 'module' object has no attribute 'find_graphviz'

可能是什么问题,如何解决?

我在 Ubuntu 14.04.4 LTS x64 和 Python 2.7.6 x64 上使用 Theano 0.8.2。


我尝试失败:

出于某种原因,Python 模块 pydot 造成了问题:

Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import pydot
>>> pydot.find_graphviz()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'find_graphviz'

我使用的是 pydot 1.2.2。

我使用 sudo pip uninstall -y pydot 卸载了它,然后我能够成功 import theano

错误报告:https://github.com/Theano/Theano/issues/4759

pydot1.2.x版本中,find_graphviz功能已经deprecated. To fix this issue, you should install pydot 1.1.0 version here https://github.com/erocarrera/pydot/tree/v1.1.0。这对我有用。可能有帮助。

我通过安装 pydot-ng 解决了 --> $ pip install pydot-ng

我用

解决了
sudo pip install graphviz
sudo apt-get install graphviz

pydot 版本 1.2.3 工作正常