**
AttributeError: module ‘tensorflow’ has no attribute ‘compat’ when importing tensorflow
**
出现这个问题原因是你装过了两个大版本的tf。比如说1.x跨越到2.x,或者1.11跨越到1.14以上。
出现报错原因是tf的辅助包出问题了。比如tensorflow-estimator或者tensorflow-datasets,或者hub之类的。把他卸了,重新执行下pip install tensorflow==1.15.2就行。1.15.2是我打的比方。