MacOSX 10.11上用于python的Matlab Engine的损坏版本

时间:2016-05-10 17:42:38

标签: python matlab matlab-engine

去年秋天我使用了Matlab Engine for Python,没有遇到任何麻烦。我今天只是尝试重用我的旧代码,我收到以下错误:

>>> import matlab.engine
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/matlab/engine/__init__.py", line 59, in <module>
    raise EnvironmentError('The installation of MATLAB Engine for Python is '
EnvironmentError: The installation of MATLAB Engine for Python is corrupted.  Please reinstall it or contact MathWorks Technical Support for assistance.

我使用Python 2.7和Matlab 2015a在MacOSX 10.11(El Capitan)上。我已经两次重新安装了Matlab引擎,但没有区别,我仍然得到同样的错误。

查看 ini .py文件,似乎失败的行如下,产生了此处复制的错误:

>>> pythonengine = importlib.import_module("matlabengineforpython"+_PYTHONVERSION)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
ImportError: dlopen(/Applications/MATLAB_R2015a.app/extern/engines/python/dist/matlab/engine/maci64/matlabengineforpython2_7.so, 2): Library not loaded: @rpath/libpython2.7.dylib
  Referenced from: /Applications/MATLAB_R2015a.app/extern/engines/python/dist/matlab/engine/maci64/matlabengineforpython2_7.so
  Reason: image not found

我已经阅读了一个类似的问题,答案指向libpython2.7.dylib HERE的问题,但我不确定我理解解决方案。我可以在/usr/lib/文件夹中看到libpython2.7.dylib文件。

1 个答案:

答案 0 :(得分:0)

基于THIS LINK,似乎可能的问题是MacOSX 10.11需要Matlab 2015b或更高版本。但是,Matlab 2015a现在在我的电脑上工作正常,所以我不确定引擎为什么不会。

MacOSX requirements for Matlab Engine