Traceback (most recent call last): File "C:\Users\Adminis\Desktop\practice\颜色校正方法\main.py", line 61, in <module> img = auto_whiteBalance(img_data) File "C:\Users\Adminis\Desktop\practice\颜色校正方法\main.py", line 20, in auto_whiteBalance L_list = list(np.reshape(RL, (RL.shape[0] * RL.shape[1],)).astype(np.int)) File "C:\Users\Adminis\AppData\Local\Programs\Python\Python39\lib\site-packages\numpy\__init__.py", line 305, in __getattr__ raise AttributeError(__former_attrs__[attr]) 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: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
时间: 2023-12-02 14:04:01 浏览: 121
这个错误是由于您在代码中使用了`np.int`,而在新版本的NumPy中,`np.int`已被弃用。为了避免这个错误,您可以将`np.int`替换为Python内置的`int`。这样做不会改变任何行为并且是安全的。如果您希望指定精度,可以使用`np.int64`或`np.int32`等。您还可以查看NumPy的发布说明链接,了解更多关于这个问题的详细信息。
修改代码中的部分示例:
```python
L_list = list(np.reshape(RL, (RL.shape[0] * RL.shape[1],)).astype(int))
```
请尝试使用上述修改后再次运行代码,看看问题是否得到解决。如果问题仍然存在,请提供更多的代码和数据细节,以便我能够更好地帮助您解决问题。
阅读全文