Error importing matlab.engine into Python on windows
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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.
Réponses (2)
Damdae
le 8 Mar 2019
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
le 20 Mai 2016
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 commentaire
Bing Wang
le 22 Juin 2020
I countered same problem, it seems matlabengineforpython3_3 was not generated.
I wonder whether this problem is solved?
Voir également
Catégories
En savoir plus sur Call MATLAB from Python dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!