To start the MATLAB® engine within a Python® session,
you first must install the engine API as a Python package. MATLAB provides
a standard Python
setup.py file for building
and installing the engine using the
You can use the same
setup.py commands to build
and install the engine on Windows®, Mac, or Linux® systems.
Before you install, verify your Python and MATLAB configurations.
Your system has a supported version of Python and MATLAB R2014b or later. To check that Python is installed on your system, run Python at the operating system prompt.
Add the folder that contains the Python interpreter to your path, if it is not already there.
Find the path to the MATLAB folder. Start MATLAB and
matlabroot in the command window. Copy the
path returned by
To install the engine API, execute the following commands at
the operating system prompt, where
the path to the MATLAB folder. You might need administrator privileges
to execute these commands. Alternatively, use one of the nondefault
options described in Install MATLAB Engine API for Python in Nondefault
On Windows systems —
cd "matlabroot\extern\engines\python" python setup.py install
On Mac or Linux systems —
cd "matlabroot/extern/engines/python" python setup.py install