ninia / jep

Embed Python in Java
Other
1.31k stars 149 forks source link

Is it possible to use JEP without environment variable PYTHONHOME? #448

Open Daniel-Alievsky opened 1 year ago

Daniel-Alievsky commented 1 year ago

Currently I use JEP by setting "set PYTHONHOME=(our copy of Python)" in Windows cmd-file before starting our application. But sometimes it is not a good solution: some variants of distributing product do not provide access to OS environment variables.

Is it possible to inform JEP, where to find all necessary Python DLL, without environment variables?

bsteffensmeier commented 1 year ago

PyConfig.setPythonHome() can be used with MainInterpreter.setInitParams() instead of the PYTHONHOME env var.

Daniel-Alievsky commented 1 year ago

Should I call MainInterpreter.setInitParams(new PyConfig().setPythonHome(xxxx)) before any usage of SharedInterpreter(), right?

Daniel-Alievsky commented 1 year ago

It seems that yes, I've checked.

Could you also consult me, what does mean -1 default value of all PyConfig flags? Why not just 0 ?

Also, is it possible to provide getXxx methods for PyConfig fields and provide an ability to read pyConfig internal static field, stored in MainInterpreter class? It could provide more convenient interface. For example, if something goes wrong while starting Jep and I see UnsatisfiedLinkError, I need to help the user to resolve the problem. At this moment I could show such settings as PyConfig pythonHome, jepLibraryPath etc., if they contain something non-standard.

verbose-void commented 1 year ago

i have a similar question. on the client machine (after building a production jar) is it possible to include a python installation without the client having to install python and/or having them provide their env variables?