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

19 views (last 30 days)
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!

Accepted Answer

Yongjian Feng
Yongjian Feng on 1 Jul 2021
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

More Answers (0)

Categories

Find more on Performance and Memory in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!