pyversion

(Not recommended) Change default version of Python interpreter

pyversion is not recommended. Use pyenv instead.

Description

pyversion displays details about the current Python® version.

[version, executable, isloaded] = pyversion returns Python version information.

___ = pyversion version changes the default Python version on Microsoft® Windows® platforms. You can request any of the outputs from previous syntaxes. The setting is persistent across MATLAB® sessions.

___ = pyversion executable specifies the full path to the Python executable. You can use this syntax on any platform or for repackaged CPython implementation downloads.

Input Arguments

collapse all

Python version number, specified as a string or character vector. The version must contain the major and minor version numbers separated by a period. (Windows platform only)

Name of an existing Python executable file, specified as a string or character vector. This argument must contain the name of the Python executable file, and it can contain the full path.

Output Arguments

collapse all

Python version number, returned as a character vector.

Name of Python executable file, returned as a character vector.

Version loaded indicator specifying if this version is loaded, returned as logical. MATLAB loads Python when you type a py. command.

If MATLAB cannot load Python, isloaded is 0 and MATLAB displays Undefined variable "py" or function "py.command" when you type a py. command.

Compatibility Considerations

expand all

Not recommended starting in R2019b

See Also

Introduced in R2014b