module 'numpy' has no attribute 'float'

np.float 从 1.24 起被删除debug/numpy's error#^0f4287,因此在 pip 版本高于 1.24 时,所有使用该方法的语句均需要被修改,或是降低 numpy 的版本到 1.23.5 。

pip install numpy==1.23.5

参考

The deprecation for the aliases

as the numpy 1.24 release note , np.object, np.bool, np.float, np.complex, np.str, and np.int is expired (introduces NumPy 1.20).

Some of these will now give a FutureWarning in addition to raising an error since they will be mapped to the NumPy scalars in the future.

solution to modify the code

参见 http://www.icodebang.com/article/375177