Why Matlab does not see Python?

136 visualizaciones (últimos 30 días)
Sergii Snegir
Sergii Snegir el 20 de Feb. de 2022
Respondida: Julian el 17 de Ag. de 2023
I am trying to luch the python file using the pyrunfile, but got an error.
Verificatio of the python version all shows me the answer (see below), nevertheless that in comandn line i see Version 3.8.3:
What is the problem?
Thanks in advance
In Matlab:
>> pyversion
version: ''
executable: ''
library: ''
home: ''
isloaded: 0
CMD:
C:\Users\Sarr>python --version
Python 3.8.3

Respuestas (4)

Yongjian Feng
Yongjian Feng el 23 de Feb. de 2022
matlab uses PATH env var to find python. Your python installation is in a local path. Try this in matlab command line:
getenv('PATH')
If the path to your python is not there, then set the PATH env var in matlab command line
setenv('PATH', new_path_with_python_location_added)
  4 comentarios
Sergii Snegir
Sergii Snegir el 24 de Feb. de 2022
thanks. I have tried.
The result is:
Yongjian Feng
Yongjian Feng el 24 de Feb. de 2022
Sean suggested that you might need to check if you have installed a 32bit python. Start python from Windows command line like this. Your path shown above really looks like a 32bit. If so, you need to install a 64bit python to make it work.

Iniciar sesión para comentar.


Abdurrahman Dayi
Abdurrahman Dayi el 23 de Feb. de 2022
It might be the case that you are using a Matlab version that does not support python 3.8.
Kindly double check the supported python versions for your matlab version here: https://www.mathworks.com/content/dam/mathworks/mathworks-dot-com/support/sysreq/files/python-compatibility.pdf
  1 comentario
Sergii Snegir
Sergii Snegir el 23 de Feb. de 2022
Thnaks for the answer. The version I have 2021b has to work with python 3.8 (according to support info)

Iniciar sesión para comentar.


Sean de Wolski
Sean de Wolski el 23 de Feb. de 2022
Looks like you have 32-bit python. You need 64-bit Python.

Julian
Julian el 17 de Ag. de 2023
Have you tried installing Python not locally for your user, but for all users?
I have the same problem and wanted to try that now. Unfortunately I then no longer have my current environments.

Categorías

Más información sobre Call Python from MATLAB en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by