Matlab 2023a python engine fails to start

12 次查看(过去 30 天)
I've installed the python engine for Matlab2023a using the methods described in the documentation here
The installation messages claims success but, when I try to load the engine on a python terminal i get the following error:
Python 3.10.13 (main, Sep 11 2023, 13:44:35) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import matlab.engine
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/software/anaconda/2019.03/envs/gsilva/lib/python3.10/site-packages/matlab/__init__.py", line 218, in <module>
from matlabmultidimarrayforpython import double, single, uint8, int8, uint16, \
ImportError: /software/matlab/R2023a/extern/engines/python/../../../extern/bin/glnxa64/../../../sys/os/glnxa64/libstdc++.so.6: undefined symbol: __cxa_thread_atexit_impl
What should I do?

回答(1 个)

Gagan Agarwal
Gagan Agarwal 2023-9-25
Hi Gustavo Silva,
I understand that you are trying to run the MATLAB engine directly from the Python terminal, but this is not possible. To use 'MATLAB engine' in Python, you need to create a Python script. Inside the script, you can import and start the 'MATLAB engine' using the following commands:
import matlab.engine
eng = matlab.engine.start_matlab()
You can execute the python script, by calling it from MATLAB using the 'pyrunfile' function.
For more information regarding 'pyrunfile', please refer to the following documentation: -
I hope this helps!

类别

Help CenterFile Exchange 中查找有关 Call MATLAB from Python 的更多信息

标签

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by