sklearn.externals.joblib导入问题

No module named ‘sklearn.externals.joblib’

这是因为在 scikit-learn 在 0.23 版本之后已经将 joblib 移除,需要直接安装 joblib

cmd 执行

conda install joblib

如果使用 scikit-learn 的版本低于 0.23,可能出现下面的提示:

FutureWarning: sklearn.externals.joblib is deprecated in 0.21 and will be removed in 0.23. Please import this functionality directly from joblib, which can be installed with: pip install joblib. If this warning is raised when loading pickled models, you may need to re-serialize those models with scikit-learn 0.21+.

如果要使用 sklearn.externals.joblib,安装低版本 scikit-learn 即可。
cmd 执行

conda uninstall scikit-learn
conda install scikit-learn==0.22

查看 python 包信息(以 scikit-learn 为例):
cmd 执行

pip freeze | findstr scikit-learn

或者在程序里导入后自行查看

参考:
https://github.com/aws/sagemaker-tensorflow-serving-container/issues/135
https://blog.csdn.net/wy121125/article/details/104806891?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.nonecase&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-3.nonecase

你可能感兴趣的:(sklearn.externals.joblib导入问题)