Filter löschen
Filter löschen

Unable to resolve py.sys.path

26 Ansichten (letzte 30 Tage)
Max Salter
Max Salter am 26 Jul. 2023
Beantwortet: Sanjana am 22 Aug. 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!

Antworten (1)

Sanjana
Sanjana am 22 Aug. 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.

Kategorien

Mehr zu Call Python from MATLAB finden Sie in Help Center und File Exchange

Produkte


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by