import matlab.engine fails with linux and a non-standard installation directory

조회 수: 1 (최근 30일)
Hi
I've installed python in $HOME/usr/local and then the matlab link with:
$HOME/usr/local/bin/python setup.py build --build-base="$HOME/temp" install
However when I 'import matlab.engine' in python, I get the error
EnvironmentError: The installation of MATLAB Engine for Python is corrupted. Please reinstall it or contact MathWorks Technical Support for assistance.
I tried setting LD_LIBRARY_PATH=~/usr/local/lib/, and that didn't work. I also noticed that matlabengineforpython2_7.so had not been installed, but I wasn't sure what to do about that
Any suggestions? Do I gave to set any matlab related environment variables?
thanks
Richard

채택된 답변

Bo Li
Bo Li 2016년 3월 14일
Does your Python version support wide-Unicode?
>>> import sys
>>> if sys.maxunicode > 65535:
... print 'wide-unicde'
... else:
... print 'narrow-unicode'
Following link mentions the System Requirements:
What is the output in verbose mode?
%python -vvv
>>>import matlab.engine
>>>import matlabengineforpython2_7
  댓글 수: 1
Richard Black
Richard Black 2016년 3월 15일
Hi
thanks for your reply. I had to build my version of python...not only did I not add the unicode option, but I also forgot to put the --enable-shared in the configuration step, so there was no libpython2.7.so.1.0
My final configure was:
./configure --enable-unicode=ucs4 --prefix=$HOME/usr/local --exec-prefix=$HOME/usr/local --enable-shared
Anyway, it was loading stuff with python -vvv that helped identify this
thanks again
Richard

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Call MATLAB from Python에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by