更新时间:2022-03-23 04:02:22
您可以修改函数:
def _read32(bytestream):
dt = numpy.dtype(numpy.uint32).newbyteorder('>')
return numpy.frombuffer(bytestream.read(4), dtype=dt)
新版本:
def _read32(bytestream):
dt = numpy.dtype(numpy.uint32).newbyteorder('>')
return numpy.frombuffer(bytestream.read(4), dtype=dt)[0]
最后添加[0]
.
这似乎是最新版本的Numpy的问题.最近的更改使出于索引目的将单元素数组视为标量是错误的.
This appears to be an issue with the latest version of Numpy. A recent change made it an error to treat a single-element array as a scalar for the purposes of indexing.