ubuntu 安装 lightgbm

    xiaoxiao2022-07-04  174

    1. 安装python3

    2. 安装cmake:sudo apt-get install cmake

    3. 安装lightgbm:根据文档安装

    git clone --recursive https://github.com/microsoft/LightGBM

    4. 编译lightgbm

    cd LightGBM mkdir build cd build cmake .. make -j4

    编译过程中出现importerror "No Module named Setuptools"错误,需要把Setuptools安装一下

    sudo apt-get install python-setuptools

     python 3.x 安装命令:

    sudo apt-get install python3-setuptools

    apt-get命令出现错误

    Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: libpython3.5-dev : Depends: libpython3.5-stdlib (= 3.5.1-10) but 3.5.2-2ubuntu0~16.04.1 is to be installed Depends: libpython3.5 (= 3.5.1-10) but 3.5.2-2ubuntu0~16.04.1 is to be installed E: Unable to correct problems, you have held broken packages.

    解决方法:使用aptitude工具下载:aptitude 与 apt-get 一样,是 Debian 及其衍生系统中功能极其强大的包管理工具。与 apt-get 不同的是,aptitude 在处理依赖问题上更佳一些。

    sudo apt-get install aptitude # 重新下载 sudo aptitude install python3-setuptools

    5. 将lightgbm装入python包中以供调用

    cd .. cd python-package python3 setup.py install --user

    在lightgbm包下有python-package包,进去安装即可,注意可能有提醒 permission denied,所以加上 --user。如果安装python2版本则只需改为   python setup.py install --user  即可。

    6. 验证

    cd .. cd examples/python-guide python3 simple_example.py

     

    最新回复(0)