Lightgbm OSError, Library not loaded

前端 未结 7 875
抹茶落季
抹茶落季 2021-02-13 03:03

If I simply do:

import lightgbm as lgb

I\'m getting

python script.py 
Traceback (most recent call last):
File \"script.py\", li         


        
7条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-02-13 03:36

    I find a similar problem here LightGBM
    The answer and comment may help you.

    Build LightGBM in Mac:

    brew install cmake  
    brew install gcc --without-multilib  
    git clone --recursive https://github.com/Microsoft/LightGBM ; cd LightGBM  
    mkdir build ; cd build  
    cmake ..   
    make -j  
    

    Then install:

    cd ../python-packages  
    sudo python setup.py install --precompile
    

    As stated by @ecodan, you might need to force Mac to use GCC and G++ instead of the default compiler. So instead of building with cmake .., try:

    cmake -DCMAKE_C_COMPILER=/usr/local/Cellar/gcc/6.1.0/bin/gcc-6 -DCMAKE_CXX_COMPILER=/usr/local/Cellar/gcc/6.1.0/bin/g++-6 ..
    

    ajusting the versions to match yours.

提交回复
热议问题