-
Notifications
You must be signed in to change notification settings - Fork 158
Description
Is your feature request related to a problem? Please describe.
I'm attempting to create an environment for Jep that mirrors that of the Python interpreter from which it was installed. This includes sys.prefix
, sys.exec_prefix
, sys.executable
, sys._base_executable
, etc. My understanding is that Python derives these and others from the path that is set via Py_SetProgramName
. AFAIK Jep does not support configuring Python via Py_SetProgramName
. Unfortunately I cannot rely on environment variables to determine how sys.prefix
, etc. are set e.g. when running in a virtual environment.
Describe the solution you'd like
I'd like to see PyConfig
extended to include protected String programName
set via public PyConfig setProgramName(String programName) { ...
and passed to Py_SetProgramName
before Py_Initialize
. This should prompt the embedded Python interpreter to properly set sys.prefix
, etc.
Describe alternatives you've considered
I've considered setting sys.prefix
, etc. manually from Python after Python has been initialized but it's nuanced and difficult to get the ordering correct. I'm open to suggestions here as well.
Additional context
NA