运行tensorflow-datasets遇到import tensorflow.compat.v2 as tf报错ImportError: No module named tensorflow.V2

运行tensorflow-datasets遇到import tensorflow.compat.v2 as tf报错ImportError: No module named tensorflow.V2

tensorflow-datasets要求tensorflow版本>=1.13.0
我安装的tf版本为1.13.1,如果直接运行下面命令,版本过高会有报错import tensorflow.compat.V2

pip install tensorflow-datasets

所以应该写卸载过高版本

pip uninstall tensorflow-datasets --yes

然后安装

pip install tensorflow-datasets==1.0.1

这样之后,再运行下面导入数据集tensorflow_datasets命令后就不会报错了

import tensorflow_datasets as tfds

你可能感兴趣的:(Computer,Vision,python,tensorflow,神经网络)