python lightgbm安装 --Mac版

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/moonflyerj/article/details/79085042

在网上看着教程安装,结果出现问题。
先贴网上找到的教程:

#先安装cmake和gcc,安装过的直接跳过前两步
brew install cmake
brew install gcc
#克隆LightGBM项目
git clone --recursive https://github.com/Microsoft/LightGBM ; cd LightGBM
#编译安装
mkdir build ; cd build
cmake ..
make -j4
cd ../python-package
sudo python setup.py install

结果在cmake ..时报错:

CMake Error at CMakeLists.txt:24 (message):
  AppleClang wasn't supported.  Please see
  https://github.com/Microsoft/LightGBM/blob/master/docs/Installation-Guide.rst#macos


-- Configuring incomplete, errors occurred!

幸好LightGBM在报错信息里给出了官方安装教程:
https://github.com/Microsoft/LightGBM/blob/master/docs/Installation-Guide.rst#macos
发现官方教程在cmake之前有一步添加环境变量:export CXX=g++-7 CC=gcc-7

附完整安装步骤:

brew install cmake
brew install gcc
git clone --recursive https://github.com/Microsoft/LightGBM ; cd LightGBM
export CXX=g++-7 CC=gcc-7
mkdir build ; cd build
cmake ..
make -j4
cd ../python-package
python setup.py install

猜你喜欢

转载自blog.csdn.net/moonflyerj/article/details/79085042