pyenv
Change default environment of Python interpreter.
Syntax
pyenv
pe = pyenv('Version', python_path)
pe = pyenv(...)
Input argument
python_path - a string, or row characters array: executable file name of Python or version (on Windows).
Output argument
pe - PythonEnvironment object.
Description
Use pyenv to modify the default version or execution mode of the Python interpreter, ensuring these adjustments persist across various Nelson sessions.
The value set by pyenv is persistent across MATLAB sessions.
Properties:
Version: string: Python version
Executable: string: Name of Python executable file
Library: string: Shared library file
Home: string: Home folder
Status: Process status: "NotLoaded" (default), "Loaded", "Terminated"
ExecutionMode: Execution mode: "InProcess" (default) or "OutOfProcess"
Use environment variables to force python environment at each startup (usefull for snapcraft or docker distribution):
__NELSON_PYTHON_VERSION__: example "3.10"
__NELSON_PYTHON_EXECUTABLE__: example "/usr/bin/python3"
__NELSON_PYTHON_LIBRARY__: example "libpython3.10.so.1.0"
__NELSON_PYTHON_HOME__: example "/usr"
All environment variables must exist and valid to be considered.
On Windows, the pyenv('Version', '3.11') function searches the Windows Registry for the Python version associated with the specified version. It first looks in the HKCU environment, and if not found, it searches in HKLM.
Examples
See also
History
Version | Description |
---|---|
1.3.0 | initial version |
1.4.0 | environment variables to force python environment |
1.4.0 | On Windows find python by Windows registry. |
Author
Allan CORNET
Last updated