python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument解决办法

我是在使用bert==0.09的时候,遇到这个问题

原因:

numpy和h5py版本兼容问题,网上说h5py 官方已修复合并到 master 分支,但是还没发新版,在发版之前可以用降级 numpy 的方法跳过这个问题。

所以我找到适合我的应用场景的一组版本,问题就解决了。

解决:

pip3 install --upgrade h5py==2.9.0
pip3 install --upgrade numpy==1.14.2
# 备注:肯定有其它的版本配合,我这没有过多测试

# 另:Linux下解决,mac下 仍然会有报错

bug还原

#首先安装bert==0.09
pip3 install bert==0.09
# 然后,在查看帮助命令的时候报错:
bert-base-serving-start --help

bug显示:

/Users/Davide/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:526: 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_qint8 = np.dtype([("qint8", np.int8, 1)])
/Users/Davide/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:527: 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)])
/Users/Davide/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:528: 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_qint16 = np.dtype([("qint16", np.int16, 1)])
/Users/Davide/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:529: 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_quint16 = np.dtype([("quint16", np.uint16, 1)])
/Users/Davide/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:530: 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_qint32 = np.dtype([("qint32", np.int32, 1)])
/Users/Davide/anaconda3/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:535: 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_resource = np.dtype([("resource", np.ubyte, 1)])
/Users/Davide/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:36: 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

重点是:

h5py/__init__.py:36: 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`.

然后重新修改下版本后就没问题了!

注意:

        系统环境下,可能有其它的包依赖numpy,在切换numpy版本时,需要注意有木有版本ERROR,如我的环境中就有这个问题:

所以这时候,一定要做好取舍,因为h5py报错,也只是 FutureWarning,是在未来的版本中会不支持,但目前并不影响程序运行,所以,还是要根据实际情况来选择,或者还有一个办法,分多套虚拟环境进行部署。

你可能感兴趣的:(Python,DEBUG,numpy,h5py,h5py版本兼容,numpy,h5py,FutureWarning)