Skip to content

Commit 5bbae3b

Browse files
authored
Merge pull request #42 from kcl-lang/fix-kcl-lib-install
fix: kcl lib install
2 parents 40624b7 + 0bbe529 commit 5bbae3b

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

python/kcl_lib/api/service.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,14 @@ def __init__(self):
109109
install_kclvm(env_install_path)
110110
self.lib = ctypes.CDLL(os.path.join(env_install_path, lib_full_name()))
111111
else:
112-
self.lib = ctypes.CDLL(os.path.join(lib_path(), lib_full_name()))
112+
# Set the kcl lib and open it.
113+
path = lib_path()
114+
path_env = os.environ.get("PATH", "")
115+
bin_path_str = str(path)
116+
new_path_env = f"{path_env}{os.pathsep}{bin_path_str}"
117+
os.environ["PATH"] = new_path_env
118+
os.environ[KCLVM_CLI_BIN_PATH_ENV_VAR] = bin_path_str
119+
self.lib = ctypes.CDLL(os.path.join(path, lib_full_name()))
113120
# Assuming the shared library exposes a function `kclvm_service_new`
114121
self.lib.kclvm_service_new.argtypes = [ctypes.c_uint64]
115122
self.lib.kclvm_service_new.restype = ctypes.c_void_p

0 commit comments

Comments
 (0)