How to update Python version running Python in Matlab using pyenv?

On MATLAB (MacOS) with:

pe = pyenv;
ans =

In terminal:

python --version
Python 3.8.5

How can I update Python in MATLAB?

1 answer

  • answered 2021-04-21 12:19 Sardar Usama

    Documentation states that:

    ...You cannot switch between versions of Python in a single MATLAB session... If you want to change versions, restart MATLAB and then run pyenv with the new version information.

    Set Python Version on Windows Platform
    On Windows® platforms, use either:




    Note: If you downloaded a Python interpreter, but did not register it in the Windows registry, use:


    Set Python Version on Mac and Linux Platforms
    To set the version, type:


    where executable is the full path to the Python executable file.