python - Theano 属性错误: 'module' object has no attribute 'tests'

标签 python theano keras

我在 Theano 后端安装了 Keras,它工作正常,但在导入 keras 时突然出现以下错误:

    Using Theano backend.
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-570b835f182b> in <module>()
      1 # import keras
----> 2 from keras.preprocessing.image import ImageDataGenerator, array_to_img, img_to_array, load_img
      3 from keras.models import Sequential
      4 from keras.layers import Convolution2D, MaxPooling2D
      5 from keras.layers import Activation, Dropout, Flatten, Dense

/home/pjwstk.edu.pl/s16352/python/keras/keras/__init__.py in <module>()
      1 from __future__ import absolute_import
----> 2 from . import backend
      3 from . import datasets
      4 from . import engine
      5 from . import layers

/home/pjwstk.edu.pl/s16352/python/keras/keras/backend/__init__.py in <module>()
     62 if _BACKEND == 'theano':
     63     sys.stderr.write('Using Theano backend.\n')
---> 64     from .theano_backend import *
     65 elif _BACKEND == 'tensorflow':
     66     sys.stderr.write('Using TensorFlow backend.\n')

/home/pjwstk.edu.pl/s16352/python/keras/keras/backend/theano_backend.py in <module>()
----> 1 import theano
      2 from theano import tensor as T
      3 from theano.sandbox.rng_mrg import MRG_RandomStreams as RandomStreams
      4 from theano.tensor.signal import pool
      5 from theano.tensor.nnet import conv3d2d

/home/pjwstk.edu.pl/s16352/python/Theano/theano/__init__.pyc in <module>()
     98 # needed during that phase.
     99 import theano.tests
--> 100 if hasattr(theano.tests, "TheanoNoseTester"):
    101     test = theano.tests.TheanoNoseTester().test
    102 else:

AttributeError: 'module' object has no attribute 'tests'

我在服务器上的 Jupyter 笔记本中运行它。 有什么线索吗?

最佳答案

您需要安装旧版本的 Theano:0.8.2。试试 pip install Theano==0.8.2

关于python - Theano 属性错误: 'module' object has no attribute 'tests' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42738725/

相关文章:

python - 在 Python 中熔化和旋转数据框?

python - 在 Windows Server 2003 上使用 python key 环时出现错误 1312

python - 如何确定最佳层数和激活函数

c++ - c++ 中的 readNetFromTensorflow 错误

python - 如何根据Python中另一个 tkinter `Scale` 小部件的值来控制 tkinter `Scale` 小部件的值?

python - 用于从 txt.file 中排除某些短语的正则表达式

python - pylearn2 CSV数据集类型错误

python - Keras:将元数据连接到 CNN 中

linux - Theano 搜索 CUDA 7.5 文件,但我安装了 CUDA 8。如何告诉它使用 CUDA 8?

python - 为什么我不能正确使用 theano.tensor.argmax 和 theano.tensor.mean