MATLAB: Cannot execute Python code from Matlab

external apiMATLABpython

Hello,
Currently I'm trying to call Python code from Matlab (using R2019b), nevertheless when I try amy python code I have the followin error:
>> P = py.sys.path
Unable to resolve the name py.sys.path.
>> py.print
Unable to resolve the name py.print.
Matlab cannot find or load any Python code, according to pyenv the instalation from Python is correct:
>> pyenv
ans =
PythonEnvironment with properties:
Version: "3.7"
Executable: "C:\Users\alis\AppData\Local\Programs\Python\Python37\python.exe"
Library: "C:\Users\alis\AppData\Local\Programs\Python\Python37\python37.dll"
Home: "C:\Users\alis\AppData\Local\Programs\Python\Python37"
Status: NotLoaded
ExecutionMode: InProcess
How can I load Python corretly to execute Python libraries and functions from Matlab?

Best Answer

Use Python 3.7.9 version and Matlab will be able to load and execute Python code correctly.