is due to the tensorflow version, if you guessed right you should be using tensorflow2.0 and the source code is tensorflow1. A few versions. So there are errors.
solution :(1) change the import tensorflow as tf to import tensorflow.compat.v1 as tf
(2) use tf.com pat. V1. The flags replace code>
tf. The app. The flags code> p>
either way. I personally recommend the first one.
Download pycharm, select python version, and create a corresponding virtual environment for python in pycharm. If the original tensorflow2.0 version is uninstalled, install tensorflow 1.x version. Remember to check specific Version to install. code> p>
Read More:
- Tensorflow error: attributeerror: module ‘tensorflow’ has no attribute ‘unpack’ (‘pack ‘)
- Tensorflow reported an error when using session module: attributeerror: module ‘tensorflow’ has no attribute ‘session’, which has been solved
- Tensorflow error: module ‘tensorflow’ has no attribute ‘xxx’
- Attributeerror: the solution of module ‘urllib’ has no attribute ‘quote’
- module ‘tensorflow‘ has no attribute ‘placeholder‘
- Tensorflow operation report error modulenotfounderror: no module named ‘tensorflow. Python. Types’ solution
- Problem solving module ‘ tensorflow.compat . V2 ‘has no attribute’ contrib ‘and importerror cannot import name’ auto ‘
- AttributeError: module ‘keras.backend‘ has no attribute ‘eager‘
- Error reporting: attributeerror: module ‘******* has no attribute’ ******* and other problems are solved
- Attributeerror: module “Seaborn” has no attribute “lineplot”
- Attributeerror: ‘module’ object has no attribute ‘handlers’ — Python sub module import problem
- AttributeError: module…ops‘ has no attribute ‘_TensorLike‘, ValueError: `updates` argument..eager
- [error] attributeerror: module ‘SIP’ has no attribute ‘setapi‘
- module ‘tensorflow_core._api.v2.train’ has no attribute ‘slice_input_producer’
- AttributeError: module ‘os’ has no attribute ‘mknod’
- AttributeError: module ‘pkg_resources‘ has no attribute ‘declare_namespace‘
- AttributeError: module ‘onnxruntime‘ has no attribute ‘InferenceSession‘
- AttributeError:module ‘seaborn‘ has no attribute ‘tsplot‘
- Solving attributeerror: module ‘urllib’ has no attribute ‘request’
- AttributeError:module“seaborn” has no attribute “lineplot”