from statsmodels.graphics.tsaplots import plot_acf, plot_pacf
在Python中導(dǎo)入包時(shí)出現(xiàn)報(bào)錯(cuò)
報(bào)錯(cuò)原因是numpy版本不支持該引用,np.int在numpy1.20已經(jīng)被廢棄掉了
在Anaconda Prompt中查看自己所使用的numpy版本
使用以下命令:
pip show numpy
?我用的numpy版本是1.24.3,出現(xiàn)了報(bào)錯(cuò)
解決方法:更換numpy版本
同樣在Anaconda Prompt中輸入以下命令:
pip uninstall numpy #刪除已經(jīng)安裝的numpy包
pip install numpy==1.22.4 #重新安裝版本為1.22.4的numpy
我重新安裝的是1.22.4版本的numpy包,使用這個(gè)版本就不會(huì)再報(bào)錯(cuò)了。文章來源:http://www.zghlxwxcb.cn/news/detail-698954.html
其他的版本我沒有試過,大家可以自己嘗試一下。文章來源地址http://www.zghlxwxcb.cn/news/detail-698954.html
到了這里,關(guān)于python報(bào)錯(cuò):cannot import name ‘int‘ from ‘numpy‘的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!