报错: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.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
原因是该错误是由于使用了已弃用的 numpy 模块中的 np. int 别名。从 NumPy 1.20版本开始,np.int 已被移除,建议直接使用 Python 内置的 int 类型或指定精度的 NumPy 整数类型(如 np. int64 或 np. int32)
原代码:
classes_nums=np.zeros([256],np.int)
修改后:

13万+

被折叠的 条评论
为什么被折叠?



