Python3 import tensorflow 出现FutureWarning: Passing (type, 1) or '1type' 问题

解决python调用TensorFlow时出现FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecate

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接: https://blog.csdn.net/BigDream123/article/details/99467316

最近因为要做一个基于深度学习的人脸识别项目,要用到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,))])就完美解决了,如图

修改为

文章最后发布于: 2019-08-13 19:51:37
有 0 个人打赏
私信求帮助

Python3 import tensorflow 出现FutureWarning: Passing (type, 1) or '1type' 问题

numpy降级就可以了,import numpy as np -> print(np.__version__),我的是tf-1.14.0,np-1.17.1,将np改为pip install numpy==1.16.0即可

猜你喜欢

转载自www.cnblogs.com/php-linux/p/11941242.html