问题描述
在Keras中的多变量时间序列预测-LSTMs中,
- 刚刚开始numpy ==1.24.2,显示错误:module ‘numpy’ has no attribute ‘object’.
np.object
was a deprecated alias for the builtinobject
. To avoid this error in existing code, useobject
by itself. Doing this will not modify any behavior and is safe.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations - object在numpy1.20中被弃用
numpy.object替换为numpy.object_才行,但是源代码中没有显示object - 然后降版本pip install -U numpy==1.18.5
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject - 问题就是numpy版本升到1.20以上没有object,代码不能运行,但是降到1.20以下,numpy版本太低不能满足运行条件
- 所以对numpy升降版本已经解决不了问题
解决
- 解决点:在报错日志前面还有一个报错:Using TensorFlow backend
- 错误产生是因为tensorflow已经有更新,旧的内容已经不适用
- 重装TensorFlow即可
pip uninstall tensorflow
pip uninstall tensorflow-gpu
pip install tensorflow
pip install tensorflow-gpu