Error:
当前tensorflow的版本是1.13.1和2.0.0b1报错module 'tensorflow.compat.v2' has no attribute 'contrib',
尝试用import tensorflow.compat.v1 as tf 代替import tensorflow as tf,
但仍有问题 ImportError cannot import name 'auto'
Solution:
如下图所示,参考文章1中指出tf2.0 alpha开始移除了tf.contrib,需要升级。
因此使用命令pip install --upgrade tensorflow 升级为tensorflow 2.1.0即可。
参考文章:
1. https://stackoverflow.com/questions/55870127/module-tensorflow-has-no-attribute-contrib