Error importing matlab.engine into Python on windows

조회 수: 6 (최근 30일)
chen tai
chen tai 2016년 5월 20일
댓글: wallflower 2021년 1월 2일
I'm on Intel core i7 64 bits using MatlabR2014b and Python 3.3.5.amd64. I have already installed API from here , but still got these error messenger.
>>> import matlab.engine
Traceback (most recent call last):
File "C:\Python33\lib\site-packages\matlab\engine\__init__.py", line 42, in <module>
pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION)
File "C:\Python33\lib\importlib\__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
File "<frozen importlib._bootstrap>", line 1529, in _find_and_load_unlocked
ImportError: No module named 'matlabengineforpython3_3'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python33\lib\site-packages\matlab\engine\__init__.py", line 58, in <module>
pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION)
File "C:\Python33\lib\importlib\__init__.py", line 90, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 584, in _check_name_wrapper
File "<frozen importlib._bootstrap>", line 495, in set_package_wrapper
File "<frozen importlib._bootstrap>", line 508, in set_loader_wrapper
File "<frozen importlib._bootstrap>", line 1132, in load_module
File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
ImportError: DLL load failed: 找不到指定的程序。
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import matlab.engine
File "C:\Python33\lib\site-packages\matlab\engine\__init__.py", line 60, in <module>
raise EnvironmentError('The installation of MATLAB Engine for Python is '
OSError: The installation of MATLAB Engine for Python is corrupted. Please reinstall it or contact MathWorks Technical Support for assistance.

답변 (2개)

Damdae
Damdae 2019년 3월 8일
Add your matlab sub-directory ${matlabroot}\bin\win64, which is possibly,
C:\Program Files\MATLAB\R2018a\bin\win64
to the PATH variable.
It worked for me.

Bo Li
Bo Li 2016년 5월 20일
It looks like that there is a conflict between libraries used by MATLAB and libraries located in your system. You may run Python in verbose mode with "-vvv" to get more information like this:
%python -vvv
>>>import matlab.engine
>>>import matlabengineforpython3_3
If this does not help, you may use Process Monitor to check what happened when the Python Engine library failed to load.
  댓글 수: 1
Bing Wang
Bing Wang 2020년 6월 22일
I countered same problem, it seems matlabengineforpython3_3 was not generated.
I wonder whether this problem is solved?

댓글을 달려면 로그인하십시오.

카테고리

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