1

我一直在尝试安装 mlabwrap Python 库,但是当我在终端中使用命令 python setup.py install 运行 setup.py 文件时继续遇到以下错误:

Traceback (most recent call last):
  File "setup.py", line 130, in <module>
    queried_version, queried_dir, queried_platform_dir = matlab_params(cmd, WINDOWS, extra_args)
  File "setup.py", line 93, in matlab_params
    error = call(cmd, **extra_args)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 522, in call
    return Popen(*popenargs, **kwargs).wait()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

我做了一些调查,发现以下论坛帖子:https ://sourceforge.net/p/mlabwrap/mailman/message/29077359/来解决这个问题。按照此线程中的建议,我在 setup.py 文件中更改了以下内容:

__version__ = '7.3'

MATLAB_DIR = '/Applications/MATLAB_R2015a.app'

我感觉问题与查找matlab所在的目录有关,但我似乎无法解决这个问题。我没有更改我的 $PATH 变量,因为我对线程中给出的建议有点困惑。任何见解将不胜感激!

4

1 回答 1

1

为了安装 mlabwrap,您必须将 setup.py 文件修改为:

MATLAB_COMMAND = '/Applications/MATLAB_R2015a.app/bin/matlab'     # specify a full path if not in PATH
MATLAB_VERSION = 7.3      # e.g: 6 (one of (6, 6.5, 7, 7.3))
                            #      7.3 includes later versions as well
MATLAB_DIR= '/Applications/MATLAB_R2015a.app/'           # e.g: '/usr/local/matlab'; 'c:/matlab6'
PLATFORM_DIR='maci64'           # e.g: 'glnx86'; r'win32/microsoft/msvc60'
EXTRA_COMPILE_ARGS=None     # e.g: ['-G']

这些参数可能会根据您使用的 MATLAB 版本和您使用的操作系统而改变。

于 2016-07-12T17:33:31.503 回答