Error running Standalone exe with custom python function

조회 수: 5 (최근 30일)
Thomas McVay
Thomas McVay 2021년 8월 25일
답변: Kumar Pallav 2021년 10월 25일
I am running a standalone matlab exe that calls a python function "function_name" from module "module_name.py". When running the exe I receive error
  • Warning: Python commands require a supported version of CPython. See <a href="matlab:helpview([docroot '/matlab/helptargets.map'], 'getting_started_python_interface')">Getting Started with Python</a>.
  • Unable to resolve the name py.module_name.function_name
Python 3.9 is running on both desktops. Function call works on main pc before being complied. Py module was included in required files when complied. Im still new to all of this,particurly python, so any help would be appreciated. Thank you

채택된 답변

Kumar Pallav
Kumar Pallav 2021년 10월 25일
Hi,
To call python modules from MATLAB, you must have a supported version of the reference implementation (CPython) installed on your system. The versions of python compatible with MATLAB is mentioned in this document. For MATLAB version 2020b, supported python3 version are 3.6,3.7,3.8.
For the error, "Unable to resolve the name py.module_name.function_name", please check the python path and make sure that it contains an absolute path to the directory where this Python module is saved.
Use following command to check the path:
py.sys.path
Add the directory of the python module if it does not exist in the path.Please refer this document to troubleshoot the issue.
Hope this helps!

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by