linux下安装CPU版本
pip install xgboost一直失败,anaconda默认的gcc的版本是GCC4.4.7(可以通过在终端输入python查看)。而安装xgboost是用的pip install xgboost命令,是系统使用系统默认的GCC编译,系统默认的GCC版本通过 gcc --version 查看是4.8.5 可能两者版本不一致导致的。
解决方法:
先输入命令'conda install libgcc',然后在pip install xgboost,
还可以参考:https://github.com/dmlc/xgboost/issues/1946
还有一个方法时删除anaconda
linux下安装GPU版本
心塞:安装了一下午各种失败
遇到问题
CMake Error at CMakeLists.txt:96 (add_library):
Cannot find source file:
rabit/src/allreduce_base.cc 。。。。
No SOURCES given to target: rabit
升级cmake到3.2
udo apt-get install build-essential //如果系统已安装build-essential则不需要执行此步骤
wget http://www.cmake.org/files/v3.2/cmake-3.2.2.tar.gz
tar xf cmake-3.2.2.tar.gz
cd cmake-3.2.2
./configure
make
需要在config.mk里制定gcc路径
export CC = /usr/local/bin/gcc-7
export CXX = /usr/local/bin/g++-7
cp make/config.mk ./config.mk
make clean_all
安装xgboost
git clone --recursive https://github.com/dmlc/xgboost
cd xgboost
mkdir build
cd build
cmake .. -DUSE_CUDA=ON
make -j
3. 安装Python包
在xgboost根目录下
cd python-package
sudo python setup.py install
测试GPU加速
python3 tests/benchmark/benchmark.py
其他1
git clone --recursive https://github.com/dmlc/xgboost
mkdir build
cd build
cmake .. -DUSE_CUDA=ON
(cmake .. -G"Visual Studio 14 2015 Win64" -DUSE_CUDA=ON)
其他2windows下
https://www.lfd.uci.edu/~gohlke/pythonlibs/#xgboost
下载对应版本
- xgboost‑0.90‑cp36‑cp36m‑win_amd64.whl