我试着跑
#!/usr/bin/env python
import os
from numpy import *
b= ones((3, 3))
print b
save('fff', b)
a = load('fff.npy')
print a.shape
print 'fertig'
但它提出了:
Traceback (most recent call last):
File "savetest.py", line 9, in <module>
a = load('fff.npy')
File "/usr/lib/python2.6/dist-packages/numpy/lib/io.py", line 195, in load
return format.read_array(fid)
File "/usr/lib/python2.6/dist-packages/numpy/lib/format.py", line 353, in read_array
shape, fortran_order, dtype = read_array_header_1_0(fp)
File "/usr/lib/python2.6/dist-packages/numpy/lib/format.py", line 250, in read_array_header_1_0
d = safe_eval(header)
File "/usr/lib/python2.6/dist-packages/numpy/lib/utils.py", line 840, in safe_eval
ast = compiler.parse(source, "eval")
File "/usr/lib/python2.6/compiler/transformer.py", line 53, in parse
return Transformer().parseexpr(buf)
File "/usr/lib/python2.6/compiler/transformer.py", line 132, in parseexpr
return self.transform(parser.expr(text))
AttributeError: 'module' object has no attribute 'expr'
我尝试了docs.scipy.org中的示例,它在我的终端中引发了相同的错误,但它在我的 ERIC python IDE 中有效。互联网目前没有为我提供可理解或可转移的解决方案。
最后,有没有人看到我的代码或方法中的错误并能够为它提供解决方案?