Mac安装lightgbm导入import时报错的解决方案

こ雲淡風輕ζ 提交于 2020-02-27 03:50:44
OSError: dlopen(/Users/user/anaconda3/lib/python3.7/site-packages/lightgbm/lib_lightgbm.so, 6): Library not loaded: /usr/local/opt/libomp/lib/libomp.dylib
  Referenced from: /Users/user/anaconda3/lib/python3.7/site-packages/lightgbm/lib_lightgbm.so
  Reason: image not found

尝试了https://stackoverflow.com/questions/29910217/homebrew-installation-on-mac-os-x-failed-to-connect-to-raw-githubusercontent-com的方法,无效

继续花半小时排坑 https://blog.csdn.net/weixin_32087115/article/details/81489627的方法,无效

后查阅官方文档——

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.

LightGBM编译依赖OpenMP,Apple Clang不支持

命令行 brew intall libomp

解决

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!