partially initialized module ‘numpy‘ has no attribute ‘array‘ (most likely due to a circular import)

    科技2024-05-17  75

    学习numpy时写第一个程序报错如下:

    partially initialized module ‘numpy’ has no attribute ‘array’ (most likely due to a circular import)

    程序代码:

    在命令行中可以执行:

    报错原因: 因为文件名使用的"numpy"是包名!!! 切记:不能使用包名和类名来命名!!!

    解决方案: 将文件名修改为非类名、包名等。

    修改后:

    成功执行:

    Processed: 0.017, SQL: 9