当前位置 博文首页 > 3.4.20‘”错误解决案例_肖永威的专栏:XGBoost遇到“Error mess

    3.4.20‘”错误解决案例_肖永威的专栏:XGBoost遇到“Error mess

    作者:[db:作者] 时间:2021-08-31 22:31

    在Linux CentOS7和Python3.6的环境下,使用XGBoost报错,提示内容如下:

    xgboost.core.XGBoostError: XGBoost Library (libxgboost.so) could not be loaded.
    Likely causes:
      * OpenMP runtime is not installed (vcomp140.dll or libgomp-1.dll for Windows, libomp.dylib for Mac OSX, libgomp.so for Linux and other UNIX-like OSes). Mac OSX users: Run `brew install libomp` to install OpenMP runtime.
      * You are running 32-bit Python on a 64-bit OS
    Error message(s): ["/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /usr/local/python3/lib/python3.6/site-packages/xgboost/lib/libxgboost.so)"]
    

    1、检查libstdc++.so.6
    使用yum provides反查询文件在什么包中。

    [root@bigdatahost python]# yum provides libstdc++.so.6
    Loaded plugins: fastestmirror, langpacks
    Loading mirror speeds from cached hostfile
     * base: mirrors.aliyun.com
     * epel: mirrors.tuna.tsinghua.edu.cn
     * extras: mirrors.aliyun.com
     * nux-dextop: mirror.li.nux.ro
     * updates: mirrors.aliyun.com
    libstdc++-4.8.5-44.el7.i686 : GNU Standard C++ Library
    Repo        : base
    Matched from:
    Provides    : libstdc++.so.6
    

    2、安装 libstdc+±4.8.5-44.el7.i686

     [root@localhost ~]# yum install libstdc++-4.8.5-44.el7.i686
    

    3、查看libstdc++.so.6软连接情况

    [root@bigdatahost lib64]# ls -al libstdc++.so.6
    lrwxrwxrwx. 1 root root 19 Apr 27 08:20 libstdc++.so.6 -> libstdc++.so.6.0.19
    

    4、从路径/usr/local/lib64拷贝文件libstdc++.so.6.0.21(或者更高版本,例如libstdc++.so.6.0.24)到路径/usr/lib64

    [root@bigdatahost lib64]# cp /usr/local/lib64/libstdc++.so.6.0.21 libstdc++.so.6.0.21
    

    5、重新设置libstdc++.so.6软连接
    最好先备份原软连接libstdc++.so.6,再删除后重新配置libstdc++.so.6软连接。

    [root@bigdatahost lib64]# cp libstdc++.so.6  libstdc++.so.6.bak19
    [root@bigdatahost lib64]# rm -rf libstdc++.so.6
    [root@bigdatahost lib64]# ln -s libstdc++.so.6.0.21 libstdc++.so.6
    

    6、查看结果

    [root@bigdatahost lib64]# strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX
    
    

    参考:

    libaineu2004 ,/lib64/libstdc++.so.6: version `GLIBCXX_3.4.20’ not found问题解决方法 , CSDN博客,2017.08

    Biu_diudiu ,错误排查:ImportError: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20’ not found,CSDN博客,2020.03

    肖永威 , 基于CentOS7安装Python3计算环境与PyDev(Eclipse)开发工具日志(2021年) ,CSDN博客, 2021.04

    cs