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;bash



解決辦法

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,))]),建議用修改後的寫法ui

np.dtype([("quint8", np.uint8, (1,))])
複製代碼

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

相關文章
相關標籤/搜索