フィルターのクリア

Python compatibility r2023 b

12 ビュー (過去 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 Center および File ExchangeCall MATLAB from Python についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by