关于import tensorflow出现的FutureWarning问题及解决
在安装完tensorflow-gpu之后,等不及进去python里试验一下是否装成功,结果第一个import tensorflow as tf 便出现了如下问题: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)])

在搜寻网上资料后,试了其他文章的一些方法,总结解决的办法,在两台设备上装都能解决并且有效。
解决办法:
对h5py进行升级安装,在 CMD命令行输入pip install h5py==2.8.0rc1,如下:

尽管如此,在python里import tensorflow还是会报这样的错误
接下来,对numpy包进行降级,我的是最新的版本1.17.1,网上资料有说降到<1.17,于是我干脆降到了1.16,如下:

接下来import tensorflow便没有报那样的错误了

本文详细介绍了在导入TensorFlow时遇到FutureWarning警告的问题,并提供了解决方案。通过升级h5py到2.8.0rc1版本并降级numpy到1.16版本,可以消除该警告。
934

被折叠的 条评论
为什么被折叠?



