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

17 visualizzazioni (ultimi 30 giorni)
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!

Risposta accettata

Yongjian Feng
Yongjian Feng il 1 Lug 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

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by