2016-07-18 18 views
13

Khi tôi chạy import theano bằng Python, tôi nhận được thông báo lỗi sau:Nhập khẩu theano: AttributeError: 'module' đối tượng không có thuộc tính 'find_graphviz'

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' 

Điều gì có thể vấn đề này, và làm thế nào để sửa chữa nó ?

Tôi sử dụng Theano 0.8.2 trên Ubuntu 14.04.4 LTS x64 với Python 2.7.6 x64.


tôi không thành công cố gắng:

  • sudo apt-get install -y graphviz libgraphviz-dev

Trả lời

21

Trong pydot phiên bản 1.2.x, find_graphviz chức năng đã deprecated. Để khắc phục sự cố này, bạn nên cài đặt phiên bản pydot 1.1.0 tại đây https://github.com/erocarrera/pydot/tree/v1.1.0. Và nó phù hợp với tôi. Có thể giúp.

+1

Cảm ơn, tôi thấy rằng một số người [khuyên dùng] (https://github.com/Theano/Theano/commit/8d4e0fd0053496ccfed002ea2898a09627443e4e) 'pydot-ng' –

+7

Nếu bạn cần một phiên bản cũ của gói python như pydot, chỉ cần chỉ định nó trong khi cài đặt hoặc trong 'requirements.txt' của bạn, như sau:' pip install pydot == 1.1.0' – hobs

4

Đối với một số lý do, các mô-đun Python pydot đã tạo vấn đề:

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' 

Tôi đã sử dụng pydot 1.2. 2.

Tôi đã gỡ cài đặt ứng dụng bằng cách sử dụng sudo pip uninstall -y pydot và sau đó tôi có thể thành công import theano.

Bug báo cáo: https://github.com/Theano/Theano/issues/4759

11

tôi giải quyết bằng cách cài đặt pydot-ng ->$ pip install pydot-ng

2

Tôi giải quyết nó bằng cách sử dụng

sudo pip install graphviz 
sudo apt-get install graphviz 

với phiên bản 1.2.3 pydot hoạt động tốt

Các vấn đề liên quan