You can use the MATLAB® Engine API for Python® on any platform that MATLAB supports.
To use the MATLAB Engine API for Python, you must have a supported version of the reference Python implementation (also known as CPython) installed on your system. MATLAB supports versions 2.7, 3.6, 3.7, and 3.8. For more information, see Versions of Python Supported by MATLAB Products by Release.
To download and install Python, see Install Supported Python Implementation.
Note
To install version 2.7 for 64-bit MATLAB on Microsoft® Windows® systems, select the 64-bit Python version, called Windows x86-64 MSI installer.
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 www.python.org/doc
in the python.org
documentation. For help on third-party or user-defined modules, refer to the product
documentation.
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, type the following 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.
(For more details, see Python 2.7 Documentation — Cross Platform.)
To enable wide-unicode support for Python 2.7 on Linux®, configure the build with the --enable-unicode=ucs4
option. This configure option is not needed when you build any version of
Python on Mac systems, or Python 3.x on Linux.