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,))])后,发现这个报错解决了。两种方法都可以尝试一下。

posted @ 2019-09-16 14:18  Windows_XP  阅读(7568)  评论(2编辑  收藏  举报