请向我解释为什么我会遇到这个错误。我已经在 ubuntu 中安装了 python 3.5
import os
import hickle as hkl
import numpy as np
array_obj = np.ones(32768, dtype='float32')
hkl.dump(array_obj, 'test.hkl', mode='w')
结果是
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\hickle.py", line 308, in dump
h5f = file_opener(file_obj, mode, track_times)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python35\lib\site-packages\hickle.py", line 148, in file_opener
if isinstance(f, file):
NameError: name 'file' is not defined
最佳答案
Hickle 不支持 Python3(它使用 Python3 不支持的 file() 函数),但您可以找到 modified version在 GitHub 上,或者直接使用 Python2。
关于python - 希克尔名称错误 : name 'file' is not defined,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48276174/