mac安装lightgbm

  • mac版本:10.13.4

根据lightgbm官方的安装指南,首先需要安装brew。

curl -LsSf http://github.com/mxcl/homebrew/tarball/master | sudo tar xvz -C/usr/local --strip 1

上述命令执行完成后执行:

brew
  • 提示为:Please run brew update

更新brew:

brew update
  • 报错:Error: /usr/local must be writable!

赋给/usr/local目录权限:

sudo chown -R username /usr/local
  • 其中username为系统当前用户名
  • 报错:Operation not permitted

卸载重装homebrew:

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

根据官方提示,安装lightgbm。

brew install cmake
brew install gcc

安装lightGBM:

git clone --recursive https://github.com/Microsoft/LightGBM ; cd LightGBM
export CXX=g++-7 CC=gcc-7  # 将7替换成当前机器上的gcc版本,否怎可能报错Could not find compiler set in environment variable CC。
mkdir build ; cd build
cmake ..
make -j4

若执行完成后无法识别lightgbm模块,则再执行一次:

sudo pip install lightgbm

若运行import lightgbm时报错image not found,则转到lightGBM/python-pachage目录下,运行

sudo python setup.py install --precompile

即可

安装成功
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值