Window下用 Anaconda 安装lightgbm很简单,直接用
实验室的Linux服务器不能联网,这可就废劲了
/home/feng/anaconda3/envs/py36/bin/…/lib/libgomp.so.1: version `GOMP_4.0’ not found
一、github下载lightgbm
LigjtGBM网址:https://github.com/Microsoft/LightGBM
二、下载LightGBM-master.zip后上传到服务器解压缩
1 | unzip LightGBM-master.zip |
三、安装
1.前提
需要安装有CMake 、 gcc 、glibc >= 2.14
CMake安装可以参考:https://blog.csdn.net/lhl1124281072/article/details/83188055
2.安装
1 2 3 4 5 6 7 | cd LightGBM-master/ mkdir build ; cd build cmake .. make -j4 cd .. cd ./python-package/ python setup.py install --precompile |
到这已经安装成功了
3.参考链接
1.LightGBM/python软件包/
2.LightGBM Installation Guide/
四、如果有报错
1.报错OSError: /home/feng/anaconda3/envs/py36/bin/…/lib/libgomp.so.1: version `GOMP_4.0’ not found
OSError: /home/feng/anaconda3/envs/py36/bin/…/lib/libgomp.so.1: version `GOMP_4.0’ not found (required by /home/feng/Downloads/PythonPack/LightGBM-master/python-package/lightgbm/…/…/lib_lightgbm.so)
libgomp.so.1是gcc的动态库文件
**步骤1:**使用以下命令检查anconda中的libgomp.so.1文件是否包含所需的版本GOMP_4.0(在所有步骤中,请自行替换路径):
1 | strings /home/feng/anaconda3/envs/py36/bin/../lib/libgomp.so.1 |grep GOMP |
其中的
查看返回的信息,如果没有GOMP_4.0版本,请转到请转到步骤2
步骤2:
查看Linux系统动态库文件包含的模块版本:路径在
或者
我的是
1 | strings /usr/lib/x86_64-linux-gnu/libgomp.so.1 |grep GOMP |
可以看到,返回的有 GOMP_4.0,进入下一步。
如果没有就是gcc版本太低,需要升级gcc,(这可就来事情了,哈哈)
步骤3:
1 2 | sudo rm -rf /home/feng/anaconda3/envs/py36/bin/../lib/libgomp.so.1 sudo ln -s /usr/lib/x86_64-linux-gnu/libgomp.so.1 /home/feng/anaconda3/envs/py36/bin/../lib/libgomp.so.1 |
就可以了,注意上面的路径要改成自己的。
2.报错OSError: /home/feng/anaconda3/envs/py36/lib/python3.6/site-packages/scipy/sparse/…/…/…/…/libstdc++.so.6
OSError: /home/feng/anaconda3/envs/py36/lib/python3.6/site-packages/scipy/sparse/…/…/…/…/libstdc++.so.6: version `GLIBCXX_3.4.20’ not found (required by /home/feng/Downloads/PythonPack/LightGBM-master/python-package/lightgbm/…/…/lib_lightgbm.so)
这一个报错的处理方法和上面的类似,就不详细讲解了
1 2 3 4 5 6 7 8 | strings /home/feng/anaconda3/envs/py36/lib/python3.6/site-packages/scipy/sparse/../../../../libstdc++.so.6 |grep GLIBCXX strings /usr/lib/x86_64-linux-gnu/libstdc++.so.6 |grep GLIBCXX sudo rm -rf /home/feng/anaconda3/envs/py36/lib/python3.6/site-packages/scipy/sparse/../../../../libstdc++.so.6 sudo ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /home/feng/anaconda3/envs/py36/lib/python3.6/site-packages/scipy/sparse/../../../../libstdc++.so.6 |
参考链接:
LightGBM Issues
“libgomp.so.1: version