Issue
On MATLAB (MacOS) with:
pe = pyenv;
pe.Version
ans =
"2.7"
In terminal:
python --version
Python 3.8.5
How can I update Python in MATLAB?
Solution
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:pyenv('Version','version')
or
pyenv('Version','executable')
ℹ
Note: If you downloaded a Python interpreter, but did not register it in the Windows registry, use:pyenv('Version','executable')
Set Python Version on Mac and Linux Platforms
To set the version, type:pyenv('Version','executable')
where
executable
is the full path to the Python executable file.
Answered By - Sardar Usama Answer Checked By - David Goodson (WPSolving Volunteer)