Unable to resolve py.sys.path
조회 수: 36 (최근 30일)
이전 댓글 표시
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
Al Danial
2023년 7월 30일
Which version of matlab? The matlab and Python versions need to match per https://www.mathworks.com/support/requirements/python-compatibility.html
답변 (1개)
Sanjana
2023년 8월 22일
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.
댓글 수: 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!