出现module ‘tensorflow’ has no attribute ‘get_default_graph’报错的原因是tensorflow版本为2.x。解决该问题的方法有两个。
1.降级tensorflow
安装tensorflow1.x的版本。
2.最开始调用tensorflow1.x的库
将一开头的代码import tensorflow as tf 换成 import tensorflow.compat.v1 as tf
希望能够解决你的问题。
出现module ‘tensorflow’ has no attribute ‘get_default_graph’报错的原因是tensorflow版本为2.x。解决该问题的方法有两个。
1.降级tensorflow
安装tensorflow1.x的版本。
2.最开始调用tensorflow1.x的库
将一开头的代码import tensorflow as tf 换成 import tensorflow.compat.v1 as tf
希望能够解决你的问题。