Matlab Python module import __future__
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call Python from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!