无法从jupyter笔记本安装lightgbm

时间:2018-11-10 06:54:33

标签: machine-learning lightgbm

在jupyter笔记本中,我做了:

!pip3 install lightgbm

我收到以下消息:

Requirement already satisfied: lightgbm in /Users/tiger/anaconda/lib/python3.5/site-packages (2.2.1)
Requirement already satisfied: scikit-learn in /Users/tiger/anaconda/lib/python3.5/site-packages (from lightgbm) (0.18.1)
Requirement already satisfied: numpy in /Users/tiger/anaconda/lib/python3.5/site-packages (from lightgbm) (1.12.0)
Requirement already satisfied: scipy in /Users/tiger/anaconda/lib/python3.5/site-packages (from lightgbm) (0.18.1)

它显示软件包已安装。但是,当我尝试导入lightgbm时:

import lightgbm as lgbm

我收到以下消息:

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

2 个答案:

答案 0 :(得分:0)

安装libomp对我来说已解决(MacOS):

brew install libomp

在Linux中,它应该是:

sudo apt install libomp-dev

答案 1 :(得分:0)

它在macOS上为我工作。

$ brew install lightgbm