解决python调用TensorFlow时出现FutureWarning: Passing (type, 1)

最近因为要做一个基于深度学习的人脸识别项目,要用到TensorFlow,但是下载完成后后发现import tensorflow总是出现FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / ‘(1,)type’._np_quint8 = np.dtype([(“quint8”, np.uint8, 1)])的错误,如图
在这里插入图片描述
百度了许多,很多说是numpy的版本不对,换了numpy的版本就行了,但是我换了好几个版本都没用,仍然报错,最后发现,可以在pycharm中使用Import tensorflow,然后将点进出现的警告,进入dtype.py,修改对应行的代码,把np.dtype([(“quint8”, np.uint8, 1)])修改为np.dtype([(“quint8”, np.uint8, (1,))])就完美解决了,如图
在这里插入图片描述
修改为
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_35866846/article/details/106146259
今日推荐