[英]TypeError: an integer is required (got type bytes) while loading the pickle file
It throws below error while loading the pickle file.加载 pickle 文件时抛出以下错误。 return types.CodeType( TypeError: an integer is required (got type bytes) return types.CodeType( TypeError: 需要一个 integer(得到类型字节)
if __model is None:
with open('banglore_home_prices_model_2.pickle', 'rb') as f:
__model = pickle.load(f) - > Error is raised for this line of code
print(__model)
Looks like the error is actually raised by cloudpickle, Not sure this is raised bcz of conflicting versions.if someone have come across this issue, let me know what helped you to fix this issue.看起来错误实际上是由 cloudpickle 引发的,不确定这是冲突版本引发的 bcz。如果有人遇到过这个问题,请告诉我是什么帮助你解决了这个问题。
I have created virtual environment for this project and installed the requirements.我已经为这个项目创建了虚拟环境并安装了要求。 I'am using python3 version.我正在使用 python3 版本。
you are reading file as "rb" mode as it opens the file in binary format for reading
您正在以“rb”模式读取文件,因为它opens the file in binary format for reading
import pickle
pickle.load('banglore_home_prices_model_2.pickle')
from joblib import load
model = load('banglore_home_prices_model_2.pickle')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.