MAC安装lightgbm,xgboost失败error的解决方法

Mac系统+Anaconda3+python3.8.8

安装lightgbm,xgboost这两个集成学习算法的包是成功了的
MAC安装lightgbm,xgboost失败error的解决方法但是导入时一直报错

---------------------------------------------------------------------------
OSError                                   Traceback (most recent call last)
<ipython-input-5-b18b3f8a6dc8> in <module>
----> 1 import lightgbm

dlopen(/Users/kumahiroshi/opt/anaconda3/lib/python3.8/site-packages/lightgbm/lib_lightgbm.so, 6): Library not loaded: /usr/local/opt/libomp/lib/libomp.dylib
  Referenced from: /Users/kumahiroshi/opt/anaconda3/lib/python3.8/site-packages/lightgbm/lib_lightgbm.so
  Reason: image not found

就是一直报: OSError Reason: image not found

通过查阅资料后发现只需要在 终端 运行这行代码后重新导入即可成功:brew install libomp


brew install libomp

MAC安装lightgbm,xgboost失败error的解决方法成功了!

需要软件:Homebrew, 安装该软件可以参考:https://www.jianshu.com/p/8a2572fe60be
安装代码:ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

上一篇:conda mac安装xgboost


下一篇:【数据分析与挖掘】基于LightGBM,XGBoost,逻辑回归的分类预测实战:英雄联盟数据(有数据集和代码)