怎样在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.