Error running Standalone exe with custom python function

3 次查看(过去 30 天)
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