Installing Python for use with MATLAB
Check current installation
MATLAB:
>> pyenv
ans =
PythonEnvironment with properties:
Version: "3.7"
Executable: "C:\Users\Paul\AppData\Local\Programs\Python\Python37\python.EXE"
Library: "C:\Users\Paul\AppData\Local\Programs\Python\Python37\python37.dll"
Home: "C:\Users\Paul\AppData\Local\Programs\Python\Python37"
Status: NotLoaded
ExecutionMode: InProcess
OR
>> pyenv
ans =
PythonEnvironment with properties:
Version: ""
Executable: ""
Library: ""
Home: ""
Status: NotLoaded
ExecutionMode: InProcess
Select supported version
See current MATLAB documentation (link to pdf with compatible versions Jun 2022)
Install or update
Got to python.org, downloads, and select a supported version (probably not the latest).
Grab the Windows 64-bit installer download, and run
Note (by example): Version 3.8 has the latest release of 3.8.13. However, 3.8.10 was the last version with an installer; this is what you need. Search for “3.8.10” and download and run the “Windows installer (64-bit)” file.
Check the “Add to path” option and install
If updating, remove old version
Configure Python
Check installation:
Open a Command Prompt
py --version
py -m pip --version
Find home folder in MATLAB
Use pyenv to find home folder