macOS 上使用 lightgbm 遇到的坑及解决方法

lightgbm 包安装成功,但使用时遇到以下错误:

OSError: dlopen(/Users/Cyan/anaconda3/lib/python3.7/site-packages/lightgbm/lib_lightgbm.so, 6): Library not loaded: /usr/local/opt/libomp/lib/libomp.dylib 
Referenced from: /Users/Cyan/anaconda3/lib/python3.7/site-packages/lightgbm/lib_lightgbm.so 
Reason: image not found

最后通过官方文档解决:

For macOS users:

  • Starting from version 2.2.1, the library file in distribution wheels is built by the Apple Clang (Xcode_8.3.3) compiler. This means that you don't need to install the gcc compiler anymore. Instead of that you need to install the OpenMPlibrary, 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.

只要通过 brew install libomp 安装一个 libomp 就可以正常使用 lightgbm 了。

欢迎关注我的知乎专栏【数据池塘】,专注于分享机器学习、数据挖掘相关内容:https://zhuanlan.zhihu.com/datapool

⬇️ 扫描下方二维码关注公众号【数据池塘】 ⬇️

回复【算法】,获取最全面的机器学习算法网络图:

发布了38 篇原创文章 · 获赞 23 · 访问量 7万+

猜你喜欢

转载自blog.csdn.net/cyan_soul/article/details/100103580