问题现象
- python编译出现ImportError: No module named ‘tensorflow_datasets’
- 使用pip install tensorflow_datasets命令出现如下警告:
AttributeError: ‘_NamespacePath’ object has no attribute ‘sort’
ERROR: Command errored out with exit status 1:
......
AttributeError: '_NamespacePath' object has no attribute 'sort'
--------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
如图:
解决方法
更新setuptools:
pip3 install --upgrade pip setuptools
继而:
pip3 install tensorflow_datasets
出现如下情况:
ERROR: tensorflow-metadata 0.14.0 has requirement protobuf<4,>=3.7, but you'll have protobuf 3.6.1 which is incompatible.
运行程序出现错误:
ImportError: This version of TensorFlow Datasets requires TensorFlow version >= 1.13.0; Detected an installation of version 1.12.0. Please upgrade TensorFlow to proceed.
这两个错误显示我该更新tensorflow了。。。
所以:
pip3 install --upgrade tensorflow
然后遇到问题
ImportError: No module named ‘numpy.core._multiarray_umath’
ImportError: numpy.core.multiarray failed to import
于是升级Numpy:
pip3 install --upgrade numpy
于是又遇到问题:
FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / ‘(1,)type’.
于是将Numpy降到1.17以下
于是
pip3 uninstall numpy
pip3 install "numpy<1.17"
引用与感谢
https://blog.csdn.net/lj19940110/article/details/90105702
https://blog.csdn.net/Dickson531/article/details/78043627
https://segmentfault.com/n/1330000019916555