Unrecognized method, property, or field 'list' for class 'matlab.py​client.Pyt​honEnviron​ment'.

조회 수: 14 (최근 30일)
Hello,
I'm trying to run Python from Matlab and I'm finding some problems.
First of all I execute:
py = pyenv('Version','C:\Users\AppData\Local\Programs\Python\Python38\python.exe')
And the answer I'm getting is:
py =
PythonEnvironment with properties:
Version: "3.8"
Executable: "C:\Users\AppData\Local\Programs\Python\Python38\python.exe"
Library: "C:\Users\AppData\Local\Programs\Python\Python38\python38.dll"
Home: "C:\Users\AppData\Local\Programs\Python\Python38"
Status: NotLoaded
ExecutionMode: InProcess
After this, I'm trying to create a list with the next command:
py.list({'This','is a','list'})
And I'm getting the next error:
Unrecognized method, property, or field 'list' for class 'matlab.pyclient.PythonEnvironment'.
This happens every time that I try to execute py.something. I'm using Matlab 2020b version.
Could anyone help me out?
Thank you in advance!

채택된 답변

Yongjian Feng
Yongjian Feng 2021년 7월 1일
Hello Irati,
Why do you call this?
py = pyenv('Version','C:\Users\AppData\Local\Programs\Python\Python38\python.exe')
According to this document (https://www.mathworks.com/help/matlab/ref/pyenv.html), it should be
pe = pyenv('Version','C:\Users\AppData\Local\Programs\Python\Python38\python.exe')
Here py is overwritten by mistake.
Thanks,
Yongjian

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by