Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Install MATLAB Engine API for Python

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 distutils module. 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 type matlabroot in the command window. Copy the path returned by matlabroot.

To install the engine API, execute the following commands at the operating system prompt, where matlabroot is 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 Locations.

  • 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
    

Related Topics

External Websites

Was this topic helpful?