简体   繁体   中英

ModuleNotFoundError sklearn.preprocessing, Pickle

I have trouble with the execution of my code in Pycharm and Spyder. Beside updating all the modules with pip update --all .

In my console, I have this message

[scaler, model_power, model_alpha, model_d632] = pickle.load(open("simulator/sag.sav", 'rb'))
ModuleNotFoundError: No module named 'sklearn.preprocessing.data'

I don't know what's wrong with my code or my modules' version.

Any help?

Upgrade scikit-learn:

pip install -U scikit-learn

And try first to dump. For example:

filename = "simulator/sag.sav"
pickle.dump(filename, open(filename, 'wb'))
model = pickle.load(open(filename, 'rb'))
print("model loaded")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM