import numpy as np
a=np.random.randint(10,size=(2,2))
np.save('dd', a)
这是我的代码,看起来很简单,但是会出现以下错误:
> Traceback (most recent call last):
File "E:\py\Pwork1\src\tttttt.py", line 333, in <module>
np.savez('a',a)
File "D:\Anaconda\lib\site-packages\numpy\lib\npyio.py", line 593, in savez
_savez(file, args, kwds, False)
File "D:\Anaconda\lib\site-packages\numpy\lib\npyio.py", line 665, in _savez
pickle_kwargs=pickle_kwargs)
File "D:\Anaconda\lib\site-packages\numpy\lib\format.py", line 555, in write_array
version)
File "D:\Anaconda\lib\site-packages\numpy\lib\format.py", line 314, in _write_array_header
header = asbytes(_filter_header(header))
File "D:\Anaconda\lib\site-packages\numpy\lib\format.py", line 450, in _filter_header
for token in tokenize.generate_tokens(StringIO(asstr(s)).read):
AttributeError: 'module' object has no attribute 'generate_tokens'
这绝对不是因为我有一个generate_tokens.py或tokenize.py。我检查了tokenize,它显然有generate_tokens。