Main Content

System Requirements for MATLAB Engine API for Python

You can use MATLAB® Engine API for Python® on any platform that MATLAB supports.

Python Version Support

To use MATLAB Engine API for Python, you must have a supported version of the reference Python implementation (also known as CPython) installed on your system. For supported version information, see Versions of Python Compatible with MATLAB Products by Release.

To download and install Python, see Install Supported Python Implementation.

To call Python from your operating system prompt, do one of the following:

  • Add the full path to Python to your PATH environment variable.

  • Include the full path when you call the Python interpreter.

To determine if you are calling a supported version, type python -V at your operating system prompt to display the Python version number.

For help on the Python language, see the Python documentation at www.python.org/doc. For help on third-party or user-defined modules, refer to the product documentation.

Download 64-Bit Versions of Python and MATLAB

The architecture of MATLAB must match the architecture of Python. On the Python download site, downloads for Microsoft® Windows® platforms are 32-bit versions by default. To download the 64-bit version, choose options with the name Windows x86-64 MSI installer.

To test whether your version of Python is 32-bit or 64-bit, enter this code at the Python prompt:

import sys
print(sys.maxsize > 2**32)

This code returns True if the Python interpreter is 64-bit, and False if it is 32-bit.

Install Python in Virtual Environment

You can create a virtual environment for a specific version of Python using the Python venv module. You can also install the MATLAB Engine API for Python in a virtual environment. For venv instructions, see the MATLAB Answers™ article Python virtual environments with Python Interface. For information about virtual Python environments, see the Python tutorial Virtual Environments and Packages.

Related Topics

External Websites