去年秋天,我经常使用 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.
我在 MacOSX 10.11 (El Capitan) 上,使用 Python 2.7 和 Matlab 2015a。我已经重新安装了两次 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 文件。