在使用pycharm時(shí),報(bào)Traceback (most recent call last):
? File "D:/pythonProject/北京理工大學(xué)/數(shù)據(jù)分析和展示/numpy.py", line 5, in <module>
? ? import numpy
? File "D:\pythonProject\北京理工大學(xué)\數(shù)據(jù)分析和展示\numpy.py", line 6, in <module>
? ? print(numpy.array([0,1,2,3]))
AttributeError: partially initialized module 'numpy' has no attribute 'array' (most likely due to a circular import)的錯(cuò)誤
?包也有,那么為什么還會(huì)報(bào)這個(gè)錯(cuò)誤呢
?問題就出了你的文件名和要導(dǎo)入的包名一樣了,導(dǎo)包先導(dǎo)自己寫的包,然后外置的包。你導(dǎo)的numpy并不是你想要的包而是自己寫的包就是你這個(gè)文件。那肯定會(huì)報(bào)錯(cuò)了,你創(chuàng)建的文件又沒有封裝的XXX方法。
解決方案就是換個(gè)跟包不同的文件名就可以了文章來源:http://www.zghlxwxcb.cn/news/detail-504996.html
?文章來源地址http://www.zghlxwxcb.cn/news/detail-504996.html
到了這里,關(guān)于pycharm報(bào)(Traceback (most recent call last))||(AttributeError: partially initialized module ‘)錯(cuò)誤及解決方案的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!