After install the matlabengine for python,This ERROR accured when i import matlab engine
조회 수: 11 (최근 30일)
이전 댓글 표시

My python is ver3.7 and matlab is 2020a ,from the init.py in matlabengines it shows that this version is supported.
THEN I tried to copy the matlabengineforpython3_7.pyd from matlabroot/extern\engines\python\dist\matlab\engine\win64 to site-packages,the first moduleNotFoundError disappeared,but the rest errors still remained, how can i do with these error?
댓글 수: 0
답변 (1개)
Daniel Souza
2020년 5월 2일
편집: Daniel Souza
2020년 5월 2일
A very similar error happens when trying to install matlabengineforpython package from WSL pointing to a the installation folder of MATLAB for Windows. If that case, the following applies:
When you run
python setup.py install
from within a WSL terminal and with a valid Python environment, the package matlabengineforpython will be installed by adding the containing folder of matlabengineforpython3_7.pyd to sys.path.
See line #52 of "matlabroot/extern/engines/python/build/lib/matlab/engine/__init__.py"
sys.path.insert(0,engine_dir)
Then when you try to import matlab.engine from a Python script within WSL, importing fails so a similar error happens because *.pyd only work on Python for Windows.
If you actually had MATLAB for Linux installed inside WSL, I bet the installation of matlabengineforpython would work flawlessly. A possible workaround to this problem then is to copy matlabengineforpython3_7.so from your corresponding MATLAB for Linux folder to "matlabroot/extern/engines/python/dist/matlab/engine/win64".
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Call MATLAB from Python에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!