Effacer les filtres
Effacer les filtres

Unable to resolve py.sys.path

26 vues (au cours des 30 derniers jours)
Max Salter
Max Salter le 26 Juil 2023
Réponse apportée : Sanjana le 22 Août 2023
I am trying to call a Python function from a MATLAB script, but no matter what function I call I get the error 'Unable to resolve the name py.function'. This includes when I run py.sys.path, I get the error 'Unable to resolve the name py.sys.path'. When I call pyenv, I get:
>> pyenv
ans =
PythonEnvironment with properties:
Version: "3.10"
Executable: "C:\Users\maxml\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\python.exe"
Library: "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\python310.dll"
Home: "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0"
Status: NotLoaded
ExecutionMode: OutOfProcess
My ultimate goal is just to call a Python function from within a MATLAB script. What could be causing this behavior? Thank you in advance!
  1 commentaire
Al Danial
Al Danial le 30 Juil 2023
Which version of matlab? The matlab and Python versions need to match per https://www.mathworks.com/support/requirements/python-compatibility.html

Connectez-vous pour commenter.

Réponses (1)

Sanjana
Sanjana le 22 Août 2023
Hi Max,
I understand that you are facing an issue in calling a Python function from a MATLAB Script.As per the steps mentioned in the below documentation, the “Unable to resolve the name py.function” error occurs when the location of custom defined module containing the Python function is not added in the Python path or when the Python path itself is not added properly. To provide the path to the Python executable, use the “pyenv”.
Please refer to the following documentation for adding Python path,
Please refer to the following link, for further information on adding the Python module location in the Python path,
Hope this helps.
Regards,
Sanjana.

Catégories

En savoir plus sur Call Python from MATLAB dans Help Center et File Exchange

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by