踩坑場景
報錯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,))])后,發現這個報錯解決了。兩種方法都可以嘗試一下。