Terminate process associated with Python interpreter
terminate( terminates the process
associated with the Python® interpreter if the ExecutionMode
property is pe)OutOfProcess. Throws an error if the property value is
InProcess.
MATLAB® automatically removes standalone Python references from the workspace after calling terminate.
The best practice is to call pyenv with an
updated version value immediately after calling terminate. If you
assign a Python reference to a MATLAB data structure, then the Python reference is a deleted handle after calling terminate. If
you refer to a deleted handle, then MATLAB launches a new Python process, to acquire information from Python regarding its type. In this case, recall the terminate
and pyenv functions.
Note
Pressing Ctrl+C does not terminate the out-of-process command.