>>> from sklearn.externals.six import StringIO
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'sklearn.externals.six'
原因:
sklearn.externals.six
模块在 scikit-learn 0.23
及以后的版本已经被删除。
解决方法一
无需降级 scikit-learn。直接安装six包:
pip install six
然后直接引入即可:
from six import StringIO
解决方法二
降级scikit-learn 到版本0.22或更低版本。
在terminal:
pip install --upgrade scikit-learn==0.20.3
尝试使用国内镜像进行,例如
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
豆瓣(douban) http://pypi.douban.com/simple/
阿里云 http://mirrors.aliyun.com/pypi/simple/
参考:https://blog.youkuaiyun.com/shanlijia/article/details/124489418