其他分享
首页 > 其他分享> > AttributeError: module 'numpy' has no attribute 'array'

AttributeError: module 'numpy' has no attribute 'array'

作者:互联网

# 用numpy套件会使数组的运算变得很方便
import numpy as np
a = np.array([1,2,3])
b = np.array([5,6,8])
print(a * b)

写完发现报如下错误

Traceback (most recent call last):
  File "F:/PythonWork/PythonStu/pandas/numpy.py", line 12, in <module>
    import numpy as np
  File "F:\PythonWork\PythonStu\pandas\numpy.py", line 13, in <module>
    a = np.array([1,2,3])
AttributeError: module 'numpy' has no attribute 'array'

百度好久无果,最后发现文件名使用不合法,也写成了numpy,与套间冲突,修改完文件名之后问题解决

蔡培育的小弟 发布了85 篇原创文章 · 获赞 3 · 访问量 2428 私信 关注

标签:PythonStu,no,attribute,module,numpy,np,array,AttributeError
来源: https://blog.csdn.net/Romantic_sir/article/details/104600898