From 9cf949fd928284f300e1807545b80c99fe0b709f Mon Sep 17 00:00:00 2001 From: popo Date: Wed, 16 Feb 2011 13:35:05 +0000 Subject: [PATCH] Change the path of loading *.dll and *.so to the relative path of linear.py. --- python/linear.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/python/linear.py b/python/linear.py index 145f60f..e3327f7 100644 --- a/python/linear.py +++ b/python/linear.py @@ -3,6 +3,7 @@ from ctypes import * from ctypes.util import find_library import sys +import os # For unix the prefix 'lib' is not considered. if find_library('linear'): @@ -11,9 +12,11 @@ elif find_library('liblinear'): liblinear = CDLL(find_library('liblinear')) else: if sys.platform == 'win32': - liblinear = CDLL('../windows/liblinear.dll') + liblinear = CDLL(os.path.join(os.path.dirname(__file__),\ + '../windows/liblinear.dll')) else: - liblinear = CDLL('../liblinear.so.1') + liblinear = CDLL(os.path.join(os.path.dirname(__file__),\ + '../liblinear.so.1')) # Construct constants SOLVER_TYPE = ['L2R_LR', 'L2R_L2LOSS_SVC_DUAL', 'L2R_L2LOSS_SVC', 'L2R_L1LOSS_SVC_DUAL',\ -- 2.40.0