Error running Standalone exe with custom python function

8 views (last 30 days)
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

Accepted Answer

Kumar Pallav
Kumar Pallav on 25 Oct 2021
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!

More Answers (0)

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!