Mac OS X 10.10.3, Python 3.4.3, Matlab2015a.
I installed the matlab engine for python according to the instruction found here. However, whenever I try to import matlab.engine in python, I will get the following error message:
Python 3.4.3 (default, Apr 7 2015, 08:05:21) Type "copyright", "credits" or "license" for more information.IPython 3.1.0 -- An enhanced Interactive Python.? -> Introduction and overview of IPython's features.%quickref -> Quick reference.
help -> Python's own help system.object? -> Details about 'object', use 'object??' for extra details.Using matplotlib backend: MacOSXIn [1]: import matlab.engine---------------------------------------------------------------------------ImportError Traceback (most recent call last)/usr/local/lib/python3.4/site-packages/matlab/engine/__init__.py in <module>() 40 try:---> 41 pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION) 42 except:/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/importlib/__init__.py in import_module(name, package) 108 level += 1--> 109 return _bootstrap._gcd_import(name[level:], package, level) 110 /usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/importlib/_bootstrap.py in _gcd_import(name, package, level)/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/importlib/_bootstrap.py in _find_and_load(name, import_)/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)ImportError: No module named 'matlabengineforpython3_4'During handling of the above exception, another exception occurred:ImportError Traceback (most recent call last)/usr/local/lib/python3.4/site-packages/matlab/engine/__init__.py in <module>() 56 os.environ[_envs[_arch]] = _bin_dir---> 57 pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION) 58 except:/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/importlib/__init__.py in import_module(name, package) 108 level += 1--> 109 return _bootstrap._gcd_import(name[level:], package, level) 110 /usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/importlib/_bootstrap.py in _gcd_import(name, package, level)/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/importlib/_bootstrap.py in _find_and_load(name, import_)/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/importlib/_bootstrap.py in _load_unlocked(self)/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/importlib/_bootstrap.py in _load_backward_compatible(self)/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/importlib/_bootstrap.py in _check_name_wrapper(self, name, *args, **kwargs)/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/importlib/_bootstrap.py in load_module(self, fullname)/usr/local/Cellar/python3/3.4.3/Frameworks/Python.framework/Versions/3.4/lib/python3.4/importlib/_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)ImportError: dlopen(/Applications/MATLAB_R2015a.app/extern/engines/python/dist/matlab/engine/maci64/matlabengineforpython3_4.so, 2): Library not loaded: @rpath/libpython3.4m.dylib Referenced from: /Applications/MATLAB_R2015a.app/extern/engines/python/dist/matlab/engine/maci64/matlabengineforpython3_4.so Reason: image not foundDuring handling of the above exception, another exception occurred:OSError Traceback (most recent call last)<ipython-input-1-7ec811bb5400> in <module>()----> 1 import matlab.engine/usr/local/lib/python3.4/site-packages/matlab/engine/__init__.py in <module>() 57 pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION) 58 except:---> 59 raise EnvironmentError('The installation of MATLAB Engine for Python is ' 60 'corrupted. Please reinstall it or contact ' 61 'MathWorks Technical Support for assistance.')OSError: The installation of MATLAB Engine for Python is corrupted. Please reinstall it or contact MathWorks Technical Support for assistance.
Best Answer