2016-09-25 331 views
2

我试图在CentOS 7上使用anaconda python 3.4在Matlab R2016a上安装Matlab Engine for PythonAnaconda在Linux上安装Matlab引擎

我执行以下命令:

source activate py34 # Default is python 3.5 
python setup.py install 

输出是:

running install 
running build 
running build_py 
running install_lib 
creating /root/.local/lib/python2.7/site-packages/matlab 
creating /root/.local/lib/python2.7/site-packages/matlab/_internal 
copying build/lib/matlab/_internal/mlarray_sequence.py -> /root/.local/lib/python2.7/site-packages/matlab/_internal 
copying build/lib/matlab/_internal/__init__.py -> /root/.local/lib/python2.7/site-packages/matlab/_internal 
copying build/lib/matlab/_internal/mlarray_utils.py -> /root/.local/lib/python2.7/site-packages/matlab/_internal 
copying build/lib/matlab/mlarray.py -> /root/.local/lib/python2.7/site-packages/matlab 
creating /root/.local/lib/python2.7/site-packages/matlab/engine 
copying build/lib/matlab/engine/engineerror.py -> /root/.local/lib/python2.7/site-packages/matlab/engine 
copying build/lib/matlab/engine/futureresult.py -> /root/.local/lib/python2.7/site-packages/matlab/engine 
copying build/lib/matlab/engine/fevalfuture.py -> /root/.local/lib/python2.7/site-packages/matlab/engine 
copying build/lib/matlab/engine/basefuture.py -> /root/.local/lib/python2.7/site-packages/matlab/engine 
copying build/lib/matlab/engine/matlabengine.py -> /root/.local/lib/python2.7/site-packages/matlab/engine 
copying build/lib/matlab/engine/__init__.py -> /root/.local/lib/python2.7/site-packages/matlab/engine 
copying build/lib/matlab/engine/enginesession.py -> /root/.local/lib/python2.7/site-packages/matlab/engine 
copying build/lib/matlab/engine/_arch.txt -> /root/.local/lib/python2.7/site-packages/matlab/engine 
copying build/lib/matlab/engine/matlabfuture.py -> /root/.local/lib/python2.7/site-packages/matlab/engine 
copying build/lib/matlab/mlexceptions.py -> /root/.local/lib/python2.7/site-packages/matlab 
copying build/lib/matlab/__init__.py -> /root/.local/lib/python2.7/site-packages/matlab 
byte-compiling /root/.local/lib/python2.7/site-packages/matlab/_internal/mlarray_sequence.py to mlarray_sequence.pyc 
byte-compiling /root/.local/lib/python2.7/site-packages/matlab/_internal/__init__.py to __init__.pyc 
byte-compiling /root/.local/lib/python2.7/site-packages/matlab/_internal/mlarray_utils.py to mlarray_utils.pyc 
byte-compiling /root/.local/lib/python2.7/site-packages/matlab/mlarray.py to mlarray.pyc 
byte-compiling /root/.local/lib/python2.7/site-packages/matlab/engine/engineerror.py to engineerror.pyc 
byte-compiling /root/.local/lib/python2.7/site-packages/matlab/engine/futureresult.py to futureresult.pyc 
byte-compiling /root/.local/lib/python2.7/site-packages/matlab/engine/fevalfuture.py to fevalfuture.pyc 
byte-compiling /root/.local/lib/python2.7/site-packages/matlab/engine/basefuture.py to basefuture.pyc 
byte-compiling /root/.local/lib/python2.7/site-packages/matlab/engine/matlabengine.py to matlabengine.pyc 
byte-compiling /root/.local/lib/python2.7/site-packages/matlab/engine/__init__.py to __init__.pyc 
byte-compiling /root/.local/lib/python2.7/site-packages/matlab/engine/enginesession.py to enginesession.pyc 
byte-compiling /root/.local/lib/python2.7/site-packages/matlab/engine/matlabfuture.py to matlabfuture.pyc 
byte-compiling /root/.local/lib/python2.7/site-packages/matlab/mlexceptions.py to mlexceptions.pyc 
byte-compiling /root/.local/lib/python2.7/site-packages/matlab/__init__.py to __init__.pyc 
running install_egg_info 
Writing /root/.local/lib/python2.7/site-packages/matlabengineforpython-R2016a-py2.7.egg-info 

这多少安装MATLAB引擎成比蟒蛇的py34虚拟ENV其他系统的Python版本。我注意到OSX上的this,它确实在我的Mac上工作!任何人都可以在CentOS上为此提供帮助?

回答

3
cd "matlabroot\extern\engines\python" 
python setup.py install --prefix="installdir" 

对于Unix(OSX10)python2.7,使用蟒蛇

cd /Applications/MATLAB_R2015a.app/extern/engines/python 
python setup.py install --prefix="/Users/user/anaconda/" 

这里是Matlab的文件:

https://www.mathworks.com/help/matlab/matlab_external/install-matlab-engine-api-for-python-in-nondefault-locations.html

+0

感谢您的回答!这绝对是更好的选择:D – spacegoing

2

经过如此多的折磨后,我终于用简单的方法解决了这个问题。相反配置系统通过修改.bash_profile中使用水蟒的蟒蛇,你可以添加一个替代蟒蛇命令:

sudo update-alternatives --install /usr/bin/python python ~/anaconda3/envs/py34/bin/python 2 
    update-alternatives --display python 
    cd /usr/local/MATLAB/R2016a/extern/engines/python/ 
    sudo python setup.py install