diff --git a/python-package/xgboost/core.py b/python-package/xgboost/core.py index 0a84feb96..a94c9d767 100644 --- a/python-package/xgboost/core.py +++ b/python-package/xgboost/core.py @@ -156,6 +156,7 @@ def _load_lib() -> ctypes.CDLL: os.environ['PATH'] = os.pathsep.join( pathBackup + [os.path.dirname(lib_path)]) lib = ctypes.cdll.LoadLibrary(lib_path) + setattr(lib, "path", os.path.normpath(lib_path)) lib_success = True except OSError as e: os_error_list.append(str(e)) @@ -233,6 +234,7 @@ def build_info() -> dict: _check_call(_LIB.XGBuildInfo(ctypes.byref(j_info))) assert j_info.value is not None res = json.loads(j_info.value.decode()) # pylint: disable=no-member + res["libxgboost"] = _LIB.path return res