Unrecognized method, property, or field 'list' for class 'matlab.pyclient.PythonEnvironment'.
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!
0 个评论
采纳的回答
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 Center 和 File Exchange 中查找有关 Call Python from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!