hickle NameError:未定义名称“文件" [英] hickle NameError: name 'file' is not defined

查看:37
本文介绍了hickle NameError:未定义名称“文件"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请向我解释为什么会出现此错误.我已经在 ubuntu 中安装了 python 3.5

please explain to me why this error getting for me. I have install python 3.5 in ubuntu

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() 函数),但是你可以找到 修改版在 GitHub 上,或者直接使用 Python2.

Hickle doesn't support Python3 (it uses file() function not supported in Python3), but you can find modified version on GitHub, or just use Python2.

这篇关于hickle NameError:未定义名称“文件"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆