当我尝试加载hickle文件时,这是错误,该怎么办?
hkl.load("sources_test.hkl")
Traceback (most recent call last):
File "", line 1, in File "/opt/conda/envs/pytorch-py3.6/lib/python3.6/site-packages/hickle/hickle.py", line 515, in load raise RuntimeError("Cannot open file. This file was likely" RuntimeError: Cannot open file. This file was likely created with Python 2 and an old hickle version.
答案 0 :(得分:1)
在Python 2.7中加载hickle文件,使用protocol=0
(缓慢但安全)将其与腌菜一起转储。将pickle文件加载到Python 3.6中,然后再次使用hickle进行转储,这样您现在就拥有了与Python 3.6兼容的hickle文件。