Hello,
Currently I'm trying to call Python code from Matlab (using R2019b), nevertheless when I try amy python code I have the followin error:
>> P = py.sys.path
Unable to resolve the name py.sys.path.
>> py.print
Unable to resolve the name py.print.
Matlab cannot find or load any Python code, according to pyenv the instalation from Python is correct:
>> pyenv
ans =
PythonEnvironment with properties:
Version: "3.7"
Executable: "C:\Users\alis\AppData\Local\Programs\Python\Python37\python.exe"
Library: "C:\Users\alis\AppData\Local\Programs\Python\Python37\python37.dll"
Home: "C:\Users\alis\AppData\Local\Programs\Python\Python37"
Status: NotLoaded
ExecutionMode: InProcess
How can I load Python corretly to execute Python libraries and functions from Matlab?

댓글 수: 2

Mario Malic
Mario Malic 2021년 2월 4일
It seems that Python is not loaded, I can't really tell how to do load it, maybe these functions are not correctly called. See this video for basics https://www.mathworks.com/videos/using-matlab-with-python-1591216182793.html
Alvaro
Alvaro 2021년 2월 6일
THanks, I already saw this video, nevertheless it seems like it was a version issue, I have change the Python version to be 3.7.9 and now Matlab can call Python and execute correctly.

댓글을 달려면 로그인하십시오.

 채택된 답변

Alvaro
Alvaro 2021년 2월 6일

0 개 추천

Use Python 3.7.9 version and Matlab will be able to load and execute Python code correctly.

댓글 수: 1

Jose Olvera
Jose Olvera 2021년 8월 28일
I have Python3.6 and 3.7 nstalled ...still have problem when using pyenv or pyversion()...fails to find them

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터 및 File Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

제품

릴리스

R2019b

질문:

2021년 2월 4일

댓글:

2021년 8월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by