FSDA, starting from version 8.7.10.15 will include setupPythonEnv, a utility function designed to simplify the use of Python inside MATLAB.
The function detects a Python installation compatible with the current MATLAB release, configures pyenv automatically, and can also execute pip commands (the Python package manager) in the selected environment. Moreover, On macOS, it is also able to detect unsupported system interpreters such as the Python distributed with Xcode that is strictly reserved for OS maintenance.
This makes setupPythonEnv especially useful for users who need to install or manage Python packages required by MATLAB workflows, without leaving the MATLAB session.
Typical applications include:
- configuring a valid Python interpreter for MATLAB;
- installing required packages such as
yfinance that is used by specific functions (e.g. getFundamentals);
- listing or checking the versions of installed Python packages;
setupPythonEnv is extremely flexible and supports all full fledged pip commands, while maintaining coherence with the FSDA style syntax.
Example usages are:
setupPythonEnv
setupPythonEnv('PipCommand','install yfinance')
setupPythonEnv('PipCommand','list')
The function also supports a compact syntax, so that:
setupPythonEnv('PipCommand','yfinance')
is automatically interpreted as an installation request.
Compatibility notes
From the code, the function is designed for:
and checks Python compatibility against MATLAB releases in the range R2021b through R2026a
If no compatible Python is found, the function informs the user and suggests installing a supported version.
FSDA, starting from version 8.7.10.15 will include
setupPythonEnv, a utility function designed to simplify the use of Python inside MATLAB.The function detects a Python installation compatible with the current MATLAB release, configures
pyenvautomatically, and can also executepipcommands (the Python package manager) in the selected environment. Moreover, On macOS, it is also able to detect unsupported system interpreters such as the Python distributed with Xcode that is strictly reserved for OS maintenance.This makes
setupPythonEnvespecially useful for users who need to install or manage Python packages required by MATLAB workflows, without leaving the MATLAB session.Typical applications include:
yfinancethat is used by specific functions (e.g.getFundamentals);setupPythonEnvis extremely flexible and supports all full fledgedpipcommands, while maintaining coherence with the FSDA style syntax.Example usages are:
The function also supports a compact syntax, so that:
is automatically interpreted as an installation request.
Compatibility notes
From the code, the function is designed for:
Windows
macOS
and checks Python compatibility against MATLAB releases in the range R2021b through R2026a
If no compatible Python is found, the function informs the user and suggests installing a supported version.