Mac上安装
#先安装cmake和gcc,安装过的直接跳过前两步
brew install cmake
brew install gcc
git clone --recursive https://github.com/Microsoft/LightGBM
cd LightGBM
#在cmake之前有一步添加环境变量
export CXX=g++-8 CC=gcc-8
mkdir build ; cd build
cmake ..
make -j4
# 然后在python中安装lightgbm
pip3 install --no-binary :all: lightgbm
上面是正确的步骤,
在import lightgbm
时可能会出现如下的bug:
OSError: dlopen(/usr/local/lib/python3.6/site-packages/lightgbm/lib_lightgbm.so, 6): Library not loaded: /usr/local/opt/gcc/lib/gcc/7/libgomp.1.dylib
Referenced from: /usr/local/lib/python3.6/site-packages/lightgbm/lib_lightgbm.so
Reason: image not found
出现bug解决方案