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