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.

Compile Python Packages from Command Line


MATLAB® Compiler SDK™ cannot compile MATLAB code that uses the MATLAB Python® interface.

You can compile Python packages from both the MATLAB command line and the system terminal command line:

  • deploytool invokes one of the compiler apps to execute a presaved compiler project

  • mcc invokes the command line compiler

Execute Compiler Projects with deploytool

The deploytool command has two flags to invoke one of the compiler apps without opening a window.

  • -build project_name — Invoke the correct compiler app to build the project and not generate an installer.

  • -package project_name — Invoke the correct compiler app to build the project and generate an installer.

For example, deploytool -package magicsquare generates the binary files defined by the magicsquare project and packages them into an installer that you can distribute to others.

Compile a Python Package with mcc

The mcc command invokes the compiler and provides fine-level control over the compilation of the Python package. It, however, cannot package the results in an installer.

To invoke the compiler to generate a Python package use the -W python:namespace.packageName flag with mcc. This flag creates a Python package named packageName with methods for each of the provided MATLAB functions.

For compiling Python packages, you can also use the following options.

Compiler Python Options

-a filePathAdd any files on the path to the generated binary.
-d outFolderSpecify the folder into which the results of compilation are written.
Was this topic helpful?