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

21 次查看(过去 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