AttributeError:'module'对象没有属性'calculate'

Gre*_*reg 36 python import module python-2.7 keras

我试图使用Keras(顺序)但我尝试导入时出现以下错误:

File "kaggle_titanic_keras.py", line 3, in <module>
    from keras.models import Sequential
  File "/anaconda/lib/python2.7/site-packages/keras/__init__.py", line 4, in <module>
    from . import applications
  File "/anaconda/lib/python2.7/site-packages/keras/applications/__init__.py", line 1, in <module>
    from .vgg16 import VGG16
  File "/anaconda/lib/python2.7/site-packages/keras/applications/vgg16.py", line 14, in <module>
    from ..models import Model
  File "/anaconda/lib/python2.7/site-packages/keras/models.py", line 14, in <module>
    from . import layers as layer_module
  File "/anaconda/lib/python2.7/site-packages/keras/layers/__init__.py", line 4, in <module>
    from ..engine import Layer
  File "/anaconda/lib/python2.7/site-packages/keras/engine/__init__.py", line 8, in <module>
    from .training import Model
  File "/anaconda/lib/python2.7/site-packages/keras/engine/training.py", line 24, in <module>
    from .. import callbacks as cbks
  File "/anaconda/lib/python2.7/site-packages/keras/callbacks.py", line 25, in <module>
    from tensorflow.contrib.tensorboard.plugins import projector
  File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/__init__.py", line 30, in <module>
    from tensorflow.contrib import factorization
  File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/factorization/__init__.py", line 24, in <module>
    from tensorflow.contrib.factorization.python.ops.gmm import *
  File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/factorization/python/ops/gmm.py", line 27, in <module>
    from tensorflow.contrib.learn.python.learn.estimators import estimator
  File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/__init__.py", line 87, in <module>
    from tensorflow.contrib.learn.python.learn import *
  File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/__init__.py", line 23, in <module>
    from tensorflow.contrib.learn.python.learn import *
  File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/__init__.py", line 25, in <module>
    from tensorflow.contrib.learn.python.learn import estimators
  File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/__init__.py", line 297, in <module>
    from tensorflow.contrib.learn.python.learn.estimators.dnn import DNNClassifier
  File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/dnn.py", line 29, in <module>
    from tensorflow.contrib.learn.python.learn.estimators import dnn_linear_combined
  File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/dnn_linear_combined.py", line 31, in <module>
    from tensorflow.contrib.learn.python.learn.estimators import estimator
  File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/estimators/estimator.py", line 49, in <module>
    from tensorflow.contrib.learn.python.learn.learn_io import data_feeder
  File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/learn_io/__init__.py", line 21, in <module>
    from tensorflow.contrib.learn.python.learn.learn_io.dask_io import extract_dask_data
  File "/anaconda/lib/python2.7/site-packages/tensorflow/contrib/learn/python/learn/learn_io/dask_io.py", line 26, in <module>
    import dask.dataframe as dd
  File "/anaconda/lib/python2.7/site-packages/dask/dataframe/__init__.py", line 3, in <module>
    from .core import (DataFrame, Series, Index, _Frame, map_partitions,
  File "/anaconda/lib/python2.7/site-packages/dask/dataframe/core.py", line 38, in <module>
    pd.computation.expressions.set_use_numexpr(False)
AttributeError: 'module' object has no attribute 'computation'
Run Code Online (Sandbox Code Playgroud)

我昨天运行Python 2.7,TensorFlow 1.1,Keras 2.0.3和'升级'到Pandas 0.20.1,我怀疑这是导致问题,但错误消息没有说明它.

小智 88

更新dask到0.15.0将解决问题

更新cmd: conda update dask

输入pip show dask将显示以下消息

Name: dask
Version: 0.15.0
Summary: Parallel PyData with Task Scheduling
Home-page: http://github.com/dask/dask/
Author: Matthew Rocklin
Author-email: mrocklin@gmail.com
License: BSD
Location: c:\anaconda3\lib\site-packages
Requires:
Run Code Online (Sandbox Code Playgroud)

  • 更新dask对我有用.但是我通过pip更新它而不是conda:pip install --upgrade dask (4认同)
  • 需要根据[pandas issue 18355](https://github.com/pandas-dev/pandas/issues/18355#issuecomment-345453318)将dask更新为&gt; 0.15.3 (2认同)

use*_*775 17

dask-0.14.3工作并消除导入错误


Gre*_*reg 10

我回到了Pandas 0.19.2,它解决了这个问题.

  • 我认为更好的答案是更新dask,如下所示:/sf/answers/3123059061/ (3认同)

小智 8

我使用的完整命令是

conda install pandas=0.19.2
Run Code Online (Sandbox Code Playgroud)

并回答y降级大熊猫,它现在起作用了.


Cag*_*agg 5

我安装了以下版本:

  • 蟒蛇 3.5
  • 张量流 1.2.1
  • 熊猫 0.21
  • 达克 0.15.3

并收到以下错误:

pd.core.computation.expressions.set_use_numexpr(False)
AttributeError: 'module' object has no attribute 'expressions'
Run Code Online (Sandbox Code Playgroud)

我降级到pandas 0.19.2dask 0.15.0,python 脚本运行良好!