module ‘numpy‘ has no attribute ‘int‘.

发布时间:2023年12月27日

报错:

AttributeError: module 'numpy' has no attribute '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

解决方法:

  1. 使用numpy 1.20及以下版本(1.20.3比较稳定)
pip uninstall numpy
pip install numpy==1.20.3
  1. 使用使用numpy==1.23.5
pip uninstall numpy
pip install numpy==1.23.5

若使用numpy 1.20以下版本出现问题:

ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

提示numpy版本过低,则使用方法2,安装numpy=1.23.5

文章来源:https://blog.csdn.net/weixin_43794736/article/details/135239092
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。