diff --git a/README.md b/README.md index bc8109d..cfde1e6 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,20 @@ q) See [docker/README.md](docker/README.md) for more details. +## Configuration + +- `EMBEDPY_EXECUTABLE` export this environment variable to define the Python executable for embedPy to use. + - If not set, embedPy attempts to use `python3` and then `python` from `PATH`. +- `EMBEDPY_PYTHON_LIB_PATH` export this environment variable to define the `libpython.so` for embedPy to use. + - 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). + +Example: + +```bash +$export EMBEDPY_EXECUTABLE="/usr/bin/python" +$export EMBEDPY_PYTHON_LIB_PATH="/usr/lib/x86_64-linux-gnu/libpython3.10.so" +$q p.q +``` ## Back-incompatible changes diff --git a/p.q b/p.q index 53eafcf..8f82d35 100644 --- a/p.q +++ b/p.q @@ -6,10 +6,12 @@ o:first string .z.o; $[o="w";if[3.6>.z.K;'`$"kdb+ version must be 3.6+"];if[3.5>.z.K;'`$"kdb+ version must be 3.5+"]]; if[not .P.loaded:-1h=type@[`.p@;`numpy;`]; sc:{"'",x,"'.join([__import__('sysconfig').get_config_var(v)for v in",ssr[.j.j y;"\"";"'"],"])"};pr:{"print(",x,");"}; - c:"-c \"",pr["'.'.join([str(getattr(__import__('sys').version_info,x))for x in ['major','minor']])"],"\"2>",$[o="w";"nul "J"$"." vs first@[system"python3 ",;c;{system"python ",c}];'"embedPy requires python 3.6 or higher on windows"]; - 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 ",$[o="w";"nul "J"$"." vs first pyc c;'"embedPy requires python 3.6 or higher on windows"]; + 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