简体   繁体   中英

ImportError: No module named 'sklearn.compose' with scikit-learn==0.23.2

I'm fully aware of the previous post regarding this error. That issue was with scikit-learn < 0.20. But I'm having scikit-learn 0.23.2 and I've tried uninstall and reinstall 0.22 and 0.23 and I still have this error.

Followup: Although pip list told me the scikit-learn version is 0.23.2 , but when I ran sklearn.__version__ , the real version is 0.18.1 . Why and how to resolve this inconsistency? (Uninstall 0.23.2 didn't work)

[RESOLVED]

It turned out that my Conda environment has different sys.path as my jupyter environment. The jupyter environment used the system env, which is due to the fact that I installed the ipykernel like this: python -m ipykernel install without use --user flag. The correct way should be to do so within the Conda env and run pip install jupyter

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