导入tensorflow ,提示警告信息的消除

1.版本信息

tensorflow 1.12.0
numpy 1.12.1

2.警告信息

导入tensorflow 时会出现的警告信息

FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type.

3.解决

首先,只是一个警告信息,可以不用管,不影响使用
想去掉的话,网上有“强行”不显示警告信息的方法
也有不同的朋友导入不同库时报这个信息,解决的也有装不同库的办法
我在StackOverflow上看到一个比较有理有据的解决方案

This might or might not be your case, but the same warning is also spit out from h5py package:
/home/user/bin/conda3/lib/python3.6/site-packages/h5py/init.py:34: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters

For anyone coming here with this problem, it is a known h5py issue, introduced with numpy 1.14. As stated by the devs:

You can ignore the warning, it’s not going to cause any issues at the moment, but you should upgrade to the next release of h5py when it becomes available.

so it’s harmless. The fix has just been merged to master. But until the update is released, the workaround is to downgrade numpy to a previous version:

pip install numpy==1.13.0

就是说,这个问题是由于numpy1.14版本引入的警告信息,没有影响,在新版本更新之前,有效的方法是降级到numpy 1.13.0

可是我的已有版本是1.12.1啊。。。

试着升级到1.13.0,果然解决了问题。看来至少是保证 numpy 1.13 这个版本没问题

如果tensorflow 版本高的话,可能会要求高版本的numpy了,需要注意下。

原问题页面

小问题,in case u need.

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值