Error importing matlab.engine into Python on windows
1 回表示 (過去 30 日間)
古いコメントを表示
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
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
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
2020 年 6 月 22 日
I countered same problem, it seems matlabengineforpython3_3 was not generated.
I wonder whether this problem is solved?
参考
カテゴリ
Help Center および File Exchange で Call MATLAB from Python についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!