lightgbm pandas安装_Mac安装Lightgbm-Anaconda

本文介绍了在Mac OS X上通过Anaconda安装LightGBM的详细步骤,包括卸载现有版本、安装CMake和gcc、编译LightGBM源码以及在Anaconda环境中安装。过程中需要注意解决gcc版本问题和OpenMP库的安装,以避免运行警告。
摘要由CSDN通过智能技术生成

官方 Installation Guide

For Mac OS X users, gcc with OpenMP support must be installed first. Refer to  Installation Guide for installing gcc with OpenMP support.

操作步骤

0、卸载pip uninstall lightgbm

如果使用了pip install lightgbm,会报错。所以,首先卸载。Error: dlopen(/Users//anaconda3/envs//lib/python2.7/site-packages/lightgbm/lib_lightgbm.so, 6): Library not loaded: /usr/local/opt/gcc/lib/gcc/7/libgomp.1.dylibReferenced from: /Users//anaconda3/envs/mouse/lib/python2.7/site-packages/lightgbm/lib_lightgbm.soReason: image not found

1、Install CMake (3.2 or higher):brew install cmake

2、Install gccbrew install gcc

3、Run the following commands: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

可参考: https://blog.csdn.net/Ahub_Ha/article/details/80343300

4、下面就是在你自己的anaconda环境中安装我们刚才编译好的lightgbm了:

首先要进入你的虚拟环境;

在虚拟环境中cd到你下载的LightGBM中的以下路径:

LightGBM/python-package

运行

sudo python setup.py install --precompile

输入密码...

就完成了。

运行时会出现警告>>> import lightgbm

/Users/sumeng/app/LightGBM/LightGBM/python-package/lightgbm/__init__.py:46: UserWarning: Starting from version 2.2.1, the library file in distribution wheels for macOS is built by the Apple Clang (Xcode_8.3.3) compiler.This means that in case of installing LightGBM from PyPI via the ``pip install lightgbm`` command, you don't need to install the gcc compiler anymore.Instead of that, you need to install the OpenMP library, which is required for running LightGBM on the system with the Apple Clang compiler.You can install the OpenMP library by the following command: ``brew install libomp``.  "You can install the OpenMP library by the following command: ``brew install libomp``.", UserWarning)

不影响正常使用。如果使用下图的安装lightgbm的方式,我觉得就不会报警告

详细步骤见文章开头的Installation Guide

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值