This is machine translation

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

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Install MATLAB Engine API for Python in Nondefault Locations

Build or Install in Nondefault Folders

By default, the installer builds the engine API for Python® in the matlabroot\extern\engines\python folder. The installer installs the engine in the default Python folder. If you do not have write permission for these folders, then select one of the following nondefault options. If you install in another folder, then update the PYTHONPATH variable to the location of that folder.

Options for building and installing the engine API follow, along with the commands to enter at the operating system prompt.

Build in Nondefault Folder and Install in Default Folder

If you do not have write permission to build the engine in the MATLAB® folder, then use a nondefault folder, builddir.

cd "matlabroot\extern\engines\python"
python setup.py build --build-base="builddir" install

Build in Default Folder and Install in Nondefault Folder

If you do not have write permission to install the engine in the default Python folder, then use a nondefault folder, installdir.

cd "matlabroot\extern\engines\python"
python setup.py install --prefix="installdir"

To include installdir in the search path for Python packages, add installdir to the PYTHONPATH environment variable.

Build and Install in Nondefault Folders

If you do not have write permission for both the MATLAB folder and the default Python folder, then you can specify nondefault folders. Use builddir for the build folder and installdir for the install folder.

cd "matlabroot\extern\engines\python"
python setup.py build --build-base="builddir" install --prefix="installdir"

Install Engine in Your Home Folder

To install the engine API for your use only, use the --user option to install in your home folder.

cd "matlabroot\extern\engines\python"
python setup.py install --user

When you install with --user, you do not need to add your home folder to PYTHONPATH.

Related Examples

More About