Python 3.7 Error: Unsupported Pickle Protocol 5

扶醉桌前 提交于 2020-12-05 06:27:59

问题


I'm trying to restore a pickled config file from RLLib (json didn't work as shown in this post), and getting the following error:

config = pickle.load(open(f"{path}/params.pkl", "rb"))

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-28-c964561b863c> in <module>
----> 1 config = pickle.load(open(f"{path}/params.pkl", "rb"))

ValueError: unsupported pickle protocol: 5

Python Version = 3.7.0

How can I open this file in 3.7?


回答1:


Use pickle5 or load it into python 3.8+ and then serialize it to a lower version of it using the protocol parameter.



来源:https://stackoverflow.com/questions/63329657/python-3-7-error-unsupported-pickle-protocol-5

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!