Tensorflow1.4.0中import tensorflow.compat.v1 as tf 报错:importerror:no module named compat.v1

img


Tensorflow1.4.0中import tensorflow.compat.v1 as tf
报错:importerror:no module named compat.v1
环境:python2.7 tensorflow1.4.0 anaconda2

import tensorflow.compat.v1 应该是为2.0版本切换到1.0风格方式。 默认就是1.0风格代码,直接import tensorflow不行么?

Tensorflow要1.14版本,你降低版本试试,参考下:
https://github.com/tensorflow/tensorflow/issues/26546