生成算子时提示报错:Failed to import Python module

问题现象

如果生成算子时出现类似如下错误:

Failed to import Python module [AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead..].

问题原因

Python3.9及以上版本默认安装numpy 2.0版本,但CANN目前未适配numpy 2.0。

解决方案

将numpy版本更换到1.26。

pip3 install numpy==1.26