mac Mojave (10.14) python3 安装lightgbm

网友投稿 690 2022-10-01

mac Mojave (10.14) python3 安装lightgbm

mac Mojave (10.14) python3 安装lightgbm

今天成功安装了lightgbm,这里分享一下安装的经历首先安装:

brew install cmakebrew install libomp

然后获取lightgbm源代码

git clone --recursive LightGBMmkdir buildcd build

编译:

cmake \ -DOpenMP_C_FLAGS="-Xpreprocessor -fopenmp -I$(brew --prefix libomp)/include" \ -DOpenMP_C_LIB_NAMES="omp" \ -DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp -I$(brew --prefix libomp)/include" \ -DOpenMP_CXX_LIB_NAMES="omp" \ -DOpenMP_omp_LIBRARY=$(brew --prefix libomp)/lib/libomp.dylib \ ..

最后运行:

make -j4

然后相关的依赖就安装完毕,最后安装python的包:

pip3 install lightgbm

安装完以后测试一下:

>>> import lightgbm/usr/local/lib/python3.7/site-packages/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)>>> print(lightgbm.__version__)2.2.3

参考文献

[1].Installation Guide. ​​https://lightgbm.readthedocs.io/en/latest/Installation-Guide.html#macos​​

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:微信公众号没有声音提示怎么办?(微信公众号没有声音提示怎么办啊)
下一篇:Netty如何设置为Https访问
相关文章

 发表评论

暂时没有评论,来抢沙发吧~