python安装sklearn模块_Python: 安装 sklearn 包出现错误的解决方法

今天在安装python 的 sklearn 包时出现了 Cannot uninstall 'numpy' 和 Cannot uninstall 'scipy' 错误,下面记录了我尝试了很多网上的方法后最终成功的解决方法。

终端执行 pip install scikit-learn 后,出现 Cannot uninstall 'numpy'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

1385863-20190430131740610-2035083048.png

执行 sudo pip install --upgrade --ignore-installed --install-option '--install-data=/usr/local' numpy 后成功更新 numpy,再次执行 pip install scikit-learn ,出现

Cannot uninstall 'scipy'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

1385863-20190430131749575-768955234.png

执行 sudo pip install --upgrade scipy --ignore-installed six ,成功更新 scipy。

再次执行 pip install scikit-learn 后出现权限问题,运行 sudo pip install scikit-learn ,成功安装 sklearn包(见下图)。

1385863-20190430133042965-200458953.png

另外,我在 Python 3 下安装 scikit-learn 没有出现该类错误,可能是因为 numpy 和 scipy 的版本够高。若是要在 python 3 下安装,前面的指令中 pip 用 pip3 替代。

标签:Python,numpy,scikit,scipy,install,pip,sklearn,安装,uninstall

来源: https://www.cnblogs.com/zhenqichai/p/fix-pip-install-sklearn-problem.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值