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 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 either or both of these folders, select one of the following nondefault options. If you install to another folder, update the PYTHONPATH variable.

Type the following commands at the operating system prompt.

Build in Nondefault Folder, Install in Default Folder

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

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

Build in Default Folder, Install in Nondefault Folder

If you do not have write permission to install the engine in the default Python folder, 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, 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 to 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

Was this topic helpful?