如何使用 pyenv 在 Matlab 中更新 Python 版本 运行 Python?

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

在 MATLAB (MacOS) 上:

pe = pyenv;
pe.Version
ans =
"2.7"

在终端中:

python --version
Python 3.8.5

如何在 MATLAB 中更新 Python?

Documentation 表示:

...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.