MCPcopy Create free account
hub / github.com/antmachineintelligence/mtgbmcode / find_lib_path

Function find_lib_path

python-package/lightgbmmt/libpath.py:8–38  ·  view source on GitHub ↗

Find the path to LightGBM library files. Returns ------- lib_path: list of strings List of all found library paths to LightGBM.

()

Source from the content-addressed store, hash-verified

6
7
8def find_lib_path():
9 """Find the path to LightGBM library files.
10
11 Returns
12 -------
13 lib_path: list of strings
14 List of all found library paths to LightGBM.
15 """
16 if os.environ.get('LIGHTGBM_BUILD_DOC', False):
17 # we don't need lib_lightgbm while building docs
18 return []
19
20 curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__)))
21 dll_path = [curr_path,
22 os.path.join(curr_path, '../../'),
23 os.path.join(curr_path, 'compile'),
24 os.path.join(curr_path, '../compile'),
25 os.path.join(curr_path, '../../lib/')]
26 if system() in ('Windows', 'Microsoft'):
27 dll_path.append(os.path.join(curr_path, '../compile/Release/'))
28 dll_path.append(os.path.join(curr_path, '../compile/windows/x64/DLL/'))
29 dll_path.append(os.path.join(curr_path, '../../Release/'))
30 dll_path.append(os.path.join(curr_path, '../../windows/x64/DLL/'))
31 dll_path = [os.path.join(p, 'lib_lightgbm.dll') for p in dll_path]
32 else:
33 dll_path = [os.path.join(p, 'lib_lightgbm.so') for p in dll_path]
34 lib_path = [p for p in dll_path if os.path.exists(p) and os.path.isfile(p)]
35 if not lib_path:
36 dll_path = [os.path.realpath(p) for p in dll_path]
37 raise Exception('Cannot find lightgbm library file in following paths:\n' + '\n'.join(dll_path))
38 return lib_path

Callers 1

_load_libFunction · 0.70

Calls 4

systemClass · 0.85
joinMethod · 0.80
appendMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected