导入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.

你可能感兴趣的:(各种报错)