Python compatibility r2023 b

조회 수: 19 (최근 30일)
Stanley
Stanley 2023년 11월 14일
답변: atharva 2023년 11월 16일
Hi I followed the exact steps and I recently installed R2023b. I find the below error:I have Python 3.11.1
>>> import matlab.engine
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'matlab.engine'; 'matlab' is not a package

답변 (1개)

atharva
atharva 2023년 11월 16일
Hey Stanley,
I understand that you are facing the error "ModuleNotFoundError: No module named 'matlab.engine'; 'matlab' is not a package".
One way to potentially resolve this issue is to point the "PYTHONPATH" environment variable to the directory containing the install of MATLAB Engine.This update should trigger the correct location to be searched for the necessary modules when importing.
If you are installing in a non-default location, remember to add the location to the 'PYTHONPATH' path variable. Failing to do so would mean that Python would not be able to find the MATLAB engine module.
This link discusses how to add a location to the python path:
The missing module should have been located in the following directory for 64-bit Linux machines:
\matlab\extern\engines\python\dist\matlab\engine\glnxa64
After performing re-installation, check this directory to see if it contains the MATLAB engine module. Do check that the right version of the module has been installed.
If this step does not work, one debugging step is to run Python in verbose mode when importing the module. Python can be started in verbose mode using the following command: "python -vvv".
I hope this helps!

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by