FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecate;的解決辦法


踩坑場景

報錯FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecate;

解決辦法

1.升級numpy的版本

pip uninstall numpy
pip install numpy==1.16.4

2.將報錯的部分修改

若升級numpy的版本無效,則將將np.dtype([("quint8", np.uint8, 1)])
修改為np.dtype([("quint8", np.uint8, (1,))]),建議用修改后的寫法

np.dtype([("quint8", np.uint8, (1,))])

我一開始試過第一種方法,一開始是可以解決這個報錯的,但有一次在別的電腦也嘗試第一種方法的時候,解決不了,然后我將np.dtype([("quint8", np.uint8, 1)])修改為np.dtype([("quint8", np.uint8, (1,))])后,發現這個報錯解決了。兩種方法都可以嘗試一下。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM