解决安装lightgbm中遇到的OSError: [WinError 126] 找不到指定的模块。[couln't find the module]问题

背景:最近刷kaggle的题,里面有个用到lighgbm的,所以打算用lighgbm来试试。

先通过pip3 install lightgbm安装了包

但是运行程序的时候报这个错

Traceback (most recent call last):

  File "", line 1, in 
    import lightgbm

  File "D:\Anaconda3\lib\site-packages\lightgbm\__init__.py", line 8, in 
    from .basic import Booster, Dataset

  File "D:\Anaconda3\lib\site-packages\lightgbm\basic.py", line 32, in 
    _LIB = _load_lib()

  File "D:\Anaconda3\lib\site-packages\lightgbm\basic.py", line 27, in _load_lib
    lib = ctypes.cdll.LoadLibrary(lib_path[0])

  File "D:\Anaconda3\lib\ctypes\__init__.py", line 429, in LoadLibrary
    return self._dlltype(name)

  File "D:\Anaconda3\lib\ctypes\__init__.py", line 351, in __init__
    self._handle = _dlopen(self._name, mode)

OSError: [WinError 126] 找不到指定的模块。[couln't find the module]

找了一些资料,把自己的解决办法分享给大家。

https://www.microsoft.com/en-us/download/details.aspx?id=53587

通过上面网址下载系统对应的

vc_redist.x64.exe

即可。原因很简单,因为这个lightgbm是微软搞的,所以需要依赖他家的库。

你可能感兴趣的:(机器学习)