我正在保存一个大型的numpy数组(40,000,450,600,3)。
该数组由for
循环构建,该循环将jpg图像转换为(450,600,3)ndarrays并将数组附加到4维数组并使用numpy.savez_compressed
函数保存它。 / p>
对于前几百次迭代,numpy.load('file.npz')
函数工作正常,我能够恢复保存的npz文件。但在某些时候我得到了这个错误:
Traceback (most recent call last):
File "script.py", line 14, in <module>
numpycom = np.load('img_one.npz')
File "/home/name/.local/lib/python2.6/site-
packages/numpy/lib/npyio.py", line 373, in load
return NpzFile(fid, own_fid=own_fid)
File "/home/name/.local/lib/python2.6/site-
packages/numpy/lib/npyio.py", line 185, in __init__
_zip = zipfile_factory(fid)
File "/home/name/.local/lib/python2.6/site-
packages/numpy/lib/npyio.py", line 124, in zipfile_factory
return zipfile.ZipFile(*args, **kwargs)
File "/usr/lib64/python2.6/zipfile.py", line 696, in __init__
self._GetContents()
File "/usr/lib64/python2.6/zipfile.py", line 716, in _GetContents
self._RealGetContents()
File "/usr/lib64/python2.6/zipfile.py", line 728, in _RealGetContents
raise BadZipfile, "File is not a zip file"
zipfile.BadZipfile: File is not a zip file
Exception AttributeError: "'NpzFile' object has no attribute 'zip'" in
<bound method NpzFile.__del__ of <numpy.lib.npyio.NpzFile object at
0x2fe4110>> ignored
感谢您的帮助!