Python Numpy:明显的内存错误

Python Numpy:明显的内存错误,python,numpy,scipy,ipython,Python,Numpy,Scipy,Ipython,使用Python/Numpy,我试图导入一个文件;但是,脚本返回一个我认为是内存错误的错误: In [1]: import numpy as np In [2]: npzfile = np.load('cuda400x400x2000.npz') In [3]: U = npzfile['U'] --------------------------------------------------------------------------- SystemError

使用Python/Numpy,我试图导入一个文件;但是,脚本返回一个我认为是内存错误的错误:

In [1]: import numpy as np

In [2]: npzfile = np.load('cuda400x400x2000.npz')

In [3]: U = npzfile['U']
---------------------------------------------------------------------------
SystemError                               Traceback (most recent call last)
<ipython-input-3-0539104595dc> in <module>()
----> 1 U = npzfile['U']

/usr/lib/pymodules/python2.7/numpy/lib/npyio.pyc in __getitem__(self, key)
    232             if bytes.startswith(format.MAGIC_PREFIX):
    233                 value = BytesIO(bytes)
--> 234                 return format.read_array(value)
    235             else:
    236                 return bytes

/usr/lib/pymodules/python2.7/numpy/lib/format.pyc in read_array(fp)
    456             # way.
    457             # XXX: we can probably chunk this to avoid the memory hit.
--> 458             data = fp.read(int(count * dtype.itemsize))
    459             array = numpy.fromstring(data, dtype=dtype, count=count)
    460 

SystemError: error return without exception set
这是内存问题吗?除了购买更多的RAM,它还能以任何方式修复吗?该框是Linux Mint DE,带有Python 2.7.3rc2和Numpy 1.6.2

干杯


\T

您使用的是32位python二进制文件吗?(例如,
导入平台;platform.architecture()
返回什么?@JoeKington,返回('64位,'ELF')Hmm.)。。。嗯,这很奇怪。不过现在我想了想,如果
numpy.load
在引擎盖下使用
numpy.fromstring
,您将需要两倍的可用内存量。如果使用了
numpy.frombuffer
,则只需要原始字符串使用的内存(它将使用与原始字符串相同的内存缓冲区)。可能值得作为拉取请求进行研究。同时,您可以使用本地版本的
numpy.load
,它使用
frombuffer
代替
fromstring
。奇怪的是,它在Python 3中工作!我认为format.py第457行的评论很好地总结了numpy实现的问题!
bogeholm@bananabot ~/Desktop $ free -m
             total       used       free     shared    buffers     cached
Mem:          7956       3375       4581          0         35       1511
-/+ buffers/cache:       1827       6128
Swap:        16383          0      16383