Skip to content

pyenv

ffi · scripts/ffi/pyenv.m

  pe = pyenv ()
  pe = pyenv (name, value, ...)
Report or configure the default Python environment (MATLAB R2026a).
Returns a matlab.pyclient.PythonEnvironment object.  Name-value
keys are "Version" (executable path, or a "major.minor"
version token) and "ExecutionMode" ("InProcess" or
"OutOfProcess").
Behaviour decisions vs MATLAB R2026a (help + Pyenv.xml):
Properties are string scalars, including Status and ExecutionMode,
  so documented comparisons such as pe.Status == "Loaded" work.
Version is "major.minor" from sys.version_info.
On Unix, Library is the shared-library basename when found.
Settings persist in $HOME/.nexus/pyenv_settings.mat as char.
Status becomes "Loaded" after a successful pyrun, pyrunfile, py
  stub construction, or out-of-process py call (nexus#13023).
ExecutionMode "OutOfProcess" starts a durable Python worker on first
  py / pyrun / pyrunfile use so module state persists across calls;
  terminate on the environment object stops it (nexus#13026).
  In-process CPython embed remains nexus#1107.
See also: pyversion, pyargs, pyrun.