gpt4 book ai didi

macos - 安装后无法导入lightgbm

转载 作者:行者123 更新时间:2023-12-02 05:48:04 30 4
gpt4 key购买 nike

我的操作系统是 macOS Sierra 10.12.5,我使用的是 Anaconda 和 python 2.7。安装后,当我尝试时:将 lightgbm 导入为 lgb我收到以下消息:

OSError                                   Traceback (most recent call last)
<ipython-input-28-2ae3725bef24> in <module>()
----> 1 import lightgbm as lgb

/Users/tenggao/anaconda/lib/python2.7/site-packages/lightgbm/__init__.py in <module>()
7 from __future__ import absolute_import
8
----> 9 from .basic import Booster, Dataset
10 from .callback import (early_stopping, print_evaluation, record_evaluation,
11 reset_parameter)

/Users/tenggao/anaconda/lib/python2.7/site-packages/lightgbm/basic.py in <module>()
29
30
---> 31 _LIB = _load_lib()
32
33

/Users/tenggao/anaconda/lib/python2.7/site-packages/lightgbm/basic.py in _load_lib()
24 if len(lib_path) == 0:
25 raise Exception("cannot find LightGBM library")
---> 26 lib = ctypes.cdll.LoadLibrary(lib_path[0])
27 lib.LGBM_GetLastError.restype = ctypes.c_char_p
28 return lib

/Users/tenggao/anaconda/lib/python2.7/ctypes/__init__.pyc in LoadLibrary(self, name)
438
439 def LoadLibrary(self, name):
--> 440 return self._dlltype(name)
441
442 cdll = LibraryLoader(CDLL)

/Users/tenggao/anaconda/lib/python2.7/ctypes/__init__.pyc in __init__(self, name, mode, handle, use_errno, use_last_error)
360
361 if handle is None:
--> 362 self._handle = _dlopen(self._name, mode)
363 else:
364 self._handle = handle

OSError: dlopen(/Users/tenggao/anaconda/lib/python2.7/site-packages/lightgbm/lib_lightgbm.so, 6): Library not loaded: /usr/local/opt/libiomp/lib/libiomp5.dylib
Referenced from: /Users/tenggao/anaconda/lib/python2.7/site-packages/lightgbm/lib_lightgbm.so
Reason: image not found

预先感谢您的帮助。

最佳答案

我在 Mac 上遇到了同样的问题,只需安装 OpenMP 库即可解决此问题。

brew install libomp

For any doubt please visit the installation page here

关于macos - 安装后无法导入lightgbm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44506921/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com