LoginSignup
1
0

More than 3 years have passed since last update.

tensorflow=2.0.0で「AttributeError: module 'tensorflow' has no attribute 'get_default_graph'」が出た

Last updated at Posted at 2019-11-02

はじめに

anacondaからminicondaに変えたら、tensoflowでの問題があり、同じようなエラーに出会った人の参考になればと思い書きました。

開発環境

miniconda
tensorflow=2.0.0
keras=2.2.4
windows10

エラー内容

File "predict.py", line 81, in <module>
    main()
  File "predict.py", line 66, in main
    model=build_model()
  File "predict.py", line 23, in build_model
    model=models.Sequential()
・・・一部省略・・・
  File "C:\***\***\Miniconda3\envs\\lib\site-packages\keras\engine\network.py", line 109, in _base_init
    name = prefix + '_' + str(K.get_uid(prefix))
  File "C:\***\***\Miniconda3\envs\tf16\lib\site-packages\keras\backend\tensorflow_backend.py", line 74, in get_uid
    graph = tf.get_default_graph()
AttributeError: module 'tensorflow' has no attribute 'get_default_graph'

解決策

tensorflowのバージョンを下げます。
condaを使ってバージョン指定する方法はこちらにあります。

参考

Anacondaのconda installでビルドを指定する方法

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0