AttributeError: module ‘numpy‘ has no attribute ‘bool‘.

文章指出在使用numpy时遇到AttributeError,因为numpy.bool已不再支持,建议将代码中的np.bool改为np.bool_。提供了解决此问题的两种方法:降级numpy版本或直接修改出错文件中的布尔表示方式。
摘要由CSDN通过智能技术生成

错误结果:

错误原因:AttributeError: module 'numpy' has no attribute 'bool'.
`np.bool` was a deprecated alias for the builtin `bool`. To avoid this error in existing code, use `bool` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.bool_` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
"""

解决方法:1.换numpy版本(降低版本);2.将出错文件里的np.bool改成np.bool_

 

改成

 

就可以了 

  • 13
    点赞
  • 23
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值