Matlab Python module import __future__

조회 수: 3 (최근 30일)
leonolovich
leonolovich 2018년 3월 21일
편집: leonolovich 2018년 3월 21일
Hello - I am trying to call a Python module from within Matlab that generates a Python Error as follows. Python Error: ImportError: cannot import name np_utils
In Matlab, I am running the code: py.importlib.
P = py.sys.path;
insert(P,int32(0),'/home/thisisme/anaconda3/envs/keras_testing/lib/python2.7/site-packages/keras');
import_module('test_detector');
Most imports are processed correctly, but the code errors out down a nested function which reads as follows:
from __future__ import absolute_import
from . import np_utils
If I, however, change the 'from . import np_utils' line to simply 'import np_utils', it works fine. I would change this if I could, but this is part of the Keras library and I do not want to touch that library. I believe I should be able to import that library without a problem. It is as if Matlab doesnt know what 'from . ' means.
Any thoughts on how to resolve this?
Using: MATLAB 2017b 64-bit Python 2.7.14 64-bit Linux 64bit

답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by