MATLAB does not recognise Python environment. Mac M1

58 Views Asked by At

I am trying to use pyrunfile to run a Python file that is in my current directory. However, MATLAB does not recognise the python environment that is present on my system. Here is my MATLAB command-window output:

>> pyrunfile("LSTM.py") 
Error using feval 
Python commands require a supported version of CPython. 

Related documentation 

When trying to find my python environment, the following appears:

>> pyenv 
ans = 
PythonEnvironment with properties: 
Version: "" 
Executable: "" 
Library: "" 
Home: "" 
Status: NotLoaded 
ExecutionMode: InProcess 

For reference the system is Mac OS Sonoma 14.1.1, and MATLAB is version R2022b.

Troubleshooting notes:

  • Using >> py in the MATLAB command window yields and empty return.
  • Using >> python in the MATLAB command window yields "Unrecognized function or variable 'python'." This would lead me to believe that Python is not in my PATH. However,
  • using python in a terminal window starts the Python interpreter. So I suppose Python is in my PATH.

What else should I try?

0

There are 0 best solutions below