解决 ImportError: cannot import name 'initializations' from 'keras' (C:\Users\admin\AppData\Roaming\Python\Python37\site-packages\keras\__init__.py)

解决 ImportError: cannot import name ‘initializations‘ from ‘keras‘ :

解决 ImportError: cannot import name 'initializations' from 'keras' (C:\Users\admin\AppData\Roaming\Python\Python37\site-packages\keras\__init__.py)

【原因剖析】

上述代码用的是

  • Keras version: ‘1.0.7‘

而实际上安装的keras版本是:2.2.4 

(版本查看:)

解决 ImportError: cannot import name 'initializations' from 'keras' (C:\Users\admin\AppData\Roaming\Python\Python37\site-packages\keras\__init__.py)

因此,错误原因为:

In Keras 2.0, initializations was renamed (mirror) as initializers. You should therefore instead write:

from keras import initializers

 

解决 ImportError: cannot import name 'initializations' from 'keras' (C:\Users\admin\AppData\Roaming\Python\Python37\site-packages\keras\__init__.py)

上一篇:elementUI vue this.$confirm 和el-dialog 弹出框 移动


下一篇:CSS选择器权重