How to install xgboost in python on MacOS?

前端 未结 9 809
别那么骄傲
别那么骄傲 2020-12-23 22:19

I am a newbie and learning python. Can someone help me- how to install xgboost in python. Im using Mac 10.11. I read online and did the below mentioned step, but not able to

相关标签:
9条回答
  • 2020-12-23 23:08

    For Python-3.x, do the following in Mac

    Make sure gcc-6 (and g++-6) is installed, if not do so with

    brew install gcc
    

    Then, do the following

    git clone --recursive https://github.com/dmlc/xgboost
    cd xgboost/
    make -j4
    cd python-package
    python3 setup.py install
    

    If you are using Anaconda and haven't yet configured your path to use the binaries in ~/anaconda/bin, then run the last line as

    /path/to/anaconda/bin/python3 setup.py install

    0 讨论(0)
  • 2020-12-23 23:11

    All the other ways described here failed in my case. I managed to install by following the official installation described here: http://xgboost.readthedocs.io/en/latest/build.html#building-on-macos

    My system is MacOS Serria so I followed the instruction of "Building on macOS".

    However, instead of "replacing these two lines into(5 or 6 or 7; depending on your gcc-version" w.r.t. the config.mk file, I did:

    export CC = gcc-5
    export CXX = g++-5
    

    Even though gcc-version showed Apple LLVM version 9.0.0.

    After that by following the official instruction of "Python Package Installation" I was able to run the package in Python.

    0 讨论(0)
  • 2020-12-23 23:13

    Im running Mac OS Mojave 10.14.5 and following the "advanced method" instructions for Mac OS at https://xgboost.readthedocs.io/en/latest/build.html# worked for me. In short:

    brew install cmake 
    brew install gcc@8
    git clone --recursive https://github.com/dmlc/xgboost
    mkdir xgboost/my_build
    cd xgboost/my_build
    CC=gcc-8 CXX=g++-8 cmake ..
    make -j4
    cd ../python_package
    python3 setup.py install
    
    0 讨论(0)
提交回复
热议问题