keep-loving-pythonのブログ

Pythonを愛し続けたいです(Pythonが流行っている限りですが。。。)

解決策。AttributeError: module 'tensorflow_core.compat.v2' has no attribute 'keras'

解決策。AttributeError: module 'tensorflow_core.compat.v2' has no attribute 'keras'

環境

Windows10 Python3.7.2 GPUなしPC

エラー

AttributeError: module 'tensorflow_core.compat.v2' has no attribute 'keras'

エラー時モジュールバージョン

tensorflow                        2.1.0
Keras                             2.2.0

エラーに出会ったgithubのURL

https://github.com/CamDavidsonPilon/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers

解決策

Kerasを2.1.0にする

Keras                             2.1.0
Keras-Applications                1.0.2
Keras-Preprocessing               1.0.1

↑ しかし、これは、NG。

↓ 動いていたときの情報より、以下のバージョンにした。
 これでOK!!!

Keras                             2.1.0
Keras-Applications                1.0.8
Keras-Preprocessing               1.1.2

解決策補足

↓ どれが意味があるかわかりませんが、動作している状態のバージョンを示します。

Keras                             2.1.0
Keras-Applications                1.0.8
Keras-Preprocessing               1.1.2
tensorboard                       2.1.1
tensorboard-data-server           0.6.1
tensorboard-plugin-wit            1.7.0
tensorboardX                      2.0
tensorflow                        2.1.0
tensorflow-addons                 0.12.0
tensorflow-estimator              2.1.0
tensorflow-hub                    0.5.0
tensorflow-io-gcs-filesystem      0.24.0
tensorflow-probability            0.9.0
tensorlayer                       1.8.0
tensorpack                        0.10.1

コメント

不明点などあれば、コメントなどください。