怎樣在Mac上安裝python版本的xgboost? | how to install xgboost (python API) on Mac OS?

怎樣安裝?

用pip, 以python 3.7為例子. 最好使用virtual environment.

$ pip install xgboost
$ pip install sklearn
$ pip install libomp

sklearn是scikit learn, 不是必要, 不過裡面有些很有用的function, 比如split training and evaluation data.

libomp是OpenMp, 是xgboost package的一個dependency. 不裝在Mac上跑不了xgboost.

怎樣確認安裝成功?

Python 3.7.3 (default, Apr  7 2020, 14:06:47)
[Clang 11.0.3 (clang-1103.0.32.59)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import xgboost
>>>

如果import成功沒有error, 就是成功了.

Leave a Comment

Your email address will not be published.