np.int 报错 版本不对

`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:

从上述报错中我们可以看出得到的信息是在‘np.int’是内置‘int’的已弃用别名,据分析numpy.int在1.20版本开始就已经被官方替代但在1.24之前都还能进行使用。

目前的两种解决办法是:

1、        将 np.int 替换为 np.int_

2、        更换numpy的版本(据分析1.24之前的版本就行,我自己使用的版本为1.23.5)

pip install numpy==1.23.5

  • 13
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
根据引用\[1\]和引用\[2\],在NumPy 1.20版本中,`np.int`被标记为过时的别名,建议使用`int`来替代。因此,如果要将`np.int16`转换为`np.int8`,可以直接使用`int`来代替`np.int`。这样做不会改变任何行为,并且是安全的。所以,可以使用`np.int16`转换为`int`,然后再将其转换为`np.int8`。 #### 引用[.reference_title] - *1* [dtype=np.int报错问题](https://blog.csdn.net/weixin_51499053/article/details/126815599)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [np.int报错](https://blog.csdn.net/weixin_44692055/article/details/127769536)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [pythonnp.uint8和np.int8的不同执行时间](https://blog.csdn.net/weixin_39631951/article/details/111064875)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值