我正在尝试避免以下RuntimeWarnings。 (我知道升级软件包可以解决警告,但我不能升级。我对RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility熟悉)。我的问题是这里的警告包发生了什么,以及在import h5py
之前 捕获警告的原因。
此代码:
import warnings
with warnings.catch_warnings() as x:
import numpy
import h5py
输出RuntimeWarings:
/usr/local/lib/python2.7/dist-packages/h5py/__init__.py:34: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 80
from ._conv import register_converters as _register_converters
/usr/local/lib/python2.7/dist-packages/h5py/__init__.py:43: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 80
from . import h5a, h5d, h5ds, h5f, h5fd, h5g, h5r, h5s, h5t, h5p, h5z
/usr/local/lib/python2.7/dist-packages/h5py/_hl/group.py:21: RuntimeWarning: numpy.dtype size changed, may indicate binary incompatibility. Expected 96, got 80
from .. import h5g, h5i, h5o, h5r, h5t, h5l, h5p
但是此代码:
import numpy
import h5py
什么都不输出。
要重现此内容,请numpy==1.14.2
和h5py==2.7.1
。