关于pip安装tensorflow-datasets出现错误的解决方案

问题现象

  1. python编译出现ImportError: No module named ‘tensorflow_datasets’
  2. 使用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

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值