mac下安装lightgbm

1:先安装brew(https://www.cnblogs.com/zoulifeng2017/p/7514139.html

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 

2:接着按照官网的提示(http://lightgbm.readthedocs.io/en/latest/Installation-Guide.html

brew install cmake

brew install gcc

git clone --recursive https://github.com/Microsoft/LightGBM ; cd LightGBM
export CXX=g++-7 CC=gcc-7  # replace 7 with version of gcc installed on your machine
mkdir build ; cd build
cmake ..  (在这步就报错了,报错内容下面记录)
make -j4

CMake Error at /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):

 Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES)

Call Stack (most recent call first):

 /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)

 /usr/local/Cellar/cmake/3.11.4/share/cmake/Modules/FindOpenMP.cmake:442 (find_package_handle_standard_args)

 CMakeLists.txt:67 (find_package)

说是cmake还是gcc不支持OpenMP

找了一堆方法,都没法解决问题,最后决定还是从源头出发

3:在 /Users/zhouheng/LightGBM/build 目录下,上面报错的时候会在这个目录下生成两个错误文件,一定要先删除 rm -rf ./* ,不然下面正确的方法也会报错

4:正确的安装办法

https://blog.csdn.net/chao2016/article/details/80189703

猜你喜欢

转载自blog.csdn.net/a1066196847/article/details/81227150