Skip to content

Commit 0dfd0de

Browse files
committed
Add EMBEDPY_EXECUTABLE and EMBEDPY_PYTHON_LIB_PATH
1 parent 6f3d19f commit 0dfd0de

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,20 @@ q)
153153

154154
See [docker/README.md](docker/README.md) for more details.
155155

156+
## Configuration
157+
158+
- `EMBEDPY_EXECUTABLE` export this environment variable to define the Python executable for embedPy to use.
159+
- If not set, embedPy attempts to use `python3` and then `python` from `PATH`.
160+
- `EMBEDPY_PYTHON_LIB_PATH` export this environment variable to define the `libpython.so` for embedPy to use.
161+
- Used in cases of `'libpython` error on load of EmbedPy when filepath is incorrect. See also [FAQ](./docs/faq.md#installing-embedpy-on-system-with-python-installed-from-source).
162+
163+
Example:
164+
165+
```bash
166+
$export EMBEDPY_EXECUTABLE="/usr/bin/python"
167+
$export EMBEDPY_PYTHON_LIB_PATH="/usr/lib/x86_64-linux-gnu/libpython3.10.so"
168+
$q p.q
169+
```
156170
157171
## Back-incompatible changes
158172

p.q

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ o:first string .z.o;
66
$[o="w";if[3.6>.z.K;'`$"kdb+ version must be 3.6+"];if[3.5>.z.K;'`$"kdb+ version must be 3.5+"]];
77
if[not .P.loaded:-1h=type@[`.p@;`numpy;`];
88
sc:{"'",x,"'.join([__import__('sysconfig').get_config_var(v)for v in",ssr[.j.j y;"\"";"'"],"])"};pr:{"print(",x,");"};
9-
c:"-c \"",pr["'.'.join([str(getattr(__import__('sys').version_info,x))for x in ['major','minor']])"],"\"2>",$[o="w";"nul <nul";"/dev/null"];
10-
if[(o="w")and any 3 6>"J"$"." vs first@[system"python3 ",;c;{system"python ",c}];'"embedPy requires python 3.6 or higher on windows"];
11-
c:"-c \"",pr[$[o="w";sc["/python";`BINDIR`VERSION];sc["/libpython";`LIBDIR`LDVERSION]],"+'",$[o="w";".dll";o="l";".so";".dylib"],"'"],pr["__import__('sys').base_prefix"],pr["__import__('sys').prefix"],pr["__import__('sys').executable"],"\"2>",$[o="w";"nul <nul";"/dev/null"];
12-
`L`H`P`B set'@[system"python3 ",;c;{system"python ",c}];
9+
c:"\"",pr["'.'.join([str(getattr(__import__('sys').version_info,x))for x in ['major','minor']])"],"\"2>",$[o="w";"nul <nul";"/dev/null"];
10+
pyc:$[""~py:getenv`EMBEDPY_EXECUTABLE;{@[system"python3 -c",;x;{system"python -c",x}]};{system x," -c",y}[py]];
11+
if[(o="w")and any 3 6>"J"$"." vs first pyc c;'"embedPy requires python 3.6 or higher on windows"];
12+
c:"\"",pr[$[o="w";sc["/python";`BINDIR`VERSION];sc["/libpython";`LIBDIR`LDVERSION]],"+'",$[o="w";".dll";o="l";".so";".dylib"],"'"],pr["__import__('sys').base_prefix"],pr["__import__('sys').prefix"],pr["__import__('sys').executable"],"\"2>",$[o="w";"nul <nul";"/dev/null"];
13+
`L`H`P`B set'pyc c;
14+
if[not ""~lp:getenv`EMBEDPY_PYTHON_LIB_PATH;L:lp];
1315
.P.env:not H~P;
1416
.p:(`:./p 2:(`init;3))[L;H;B]]
1517
loaded:.P.loaded

0 commit comments

Comments
 (0)