MATLAB为什么无法导入此python库?

我想在MATLAB中使用http://www.losonczylab.org/sima/1.2/.

我可以从python正常运行.

我可以在MATLAB中导入示例依赖项.

$/opt/local/bin/python 
Python 2.7.9 (default, Dec 13 2014, 15:13:49) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin 
Type "help", "copyright", "credits" or "license" for more information. 
>>> from sima import sequence 
>>> sequence 
<module 'sima.sequence' from '/Users/eflister/Library/Python/2.7/lib/python/site-packages/sima/sequence.pyc'> 
>>> from sima import ImagingDataset 
>>> ImagingDataset 
<class 'sima.imaging.ImagingDataset'> 

在MATLAB中:

>> pyversion /opt/local/bin/python 
>> pyversion 

version: '2.7' 
executable: '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Cont...' 
library: '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib' 
home: '/opt/local/Library/Frameworks/Python.framework/Versions/2.7' 
isloaded: 0 

>> import py.picos.tools.available_solvers 
>> available_solvers 

ans = 

Python list with no properties. 

['cvxopt', 'mosek7'] 

>> import py.numpy.empty 
>> empty(0) 

ans = 

Python ndarray with properties: 

T: [1x1 py.numpy.ndarray] 
base: [1x1 py.NoneType] 
ctypes: [1x1 py.numpy.core._internal._ctypes] 
data: [1x0 py.buffer] 
dtype: [1x1 py.numpy.dtype] 
flags: [1x1 py.numpy.flagsobj] 
flat: [1x1 py.numpy.flatiter] 
imag: [1x1 py.numpy.ndarray] 
itemsize: 8 
nbytes: 0 
ndim: 1 
real: [1x1 py.numpy.ndarray] 
shape: [1x1 py.tuple] 
size: 0 
strides: [1x1 py.tuple] 

[] 

>> import py.sima.sequence 
Error using import 
Import argument 'py.sima.sequence' cannot be found or cannot be imported. 

>> import py.sima.Sequence 
Error using import 
Import argument 'py.sima.Sequence' cannot be found or cannot be imported. 

>> import py.sima.Sequence.create 
Error using import 
Import argument 'py.sima.Sequence.create' cannot be found or cannot be imported. 

>> import py.sima.sequence.create 
Error using import 
Import argument 'py.sima.sequence.create' cannot be found or cannot be imported. 

>> import py.sima.sequence 
Error using import 
Import argument 'py.sima.sequence' cannot be found or cannot be imported. 

>> import py.sima.Sequence 
Error using import 
Import argument 'py.sima.Sequence' cannot be found or cannot be imported. 

>> import py.sima.ImagingDataset 
Error using import 
Import argument 'py.sima.ImagingDataset' cannot be found or cannot be imported. 

>> import py.sima.imagingdataset 
Error using import 
Import argument 'py.sima.imagingdataset' cannot be found or cannot be imported. 

>> import py.sima 
Error using import 
Import argument 'py.sima' cannot be found or cannot be imported. 

我怎么知道为什么不能导入sima?

sima正在前进:

>> pp = py.pprint.PrettyPrinter

pp = 

  Python PrettyPrinter with no properties.

    <pprint.PrettyPrinter instance at 0x129425bd8>

>> pp.pprint(py.sys.path)
['',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/readline',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
 '/Users/eflister/Library/Python/2.7/lib/python/site-packages',
 '/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages']

我想出了以下乏味的方法来查找问题的输入-有更好的方法吗?

>定义模块为http://www.mathworks.com/help/matlab/matlab_external/call-user-defined-custom-module.html
>从MATLAB无法加载的库中的源文件复制导入
>注释掉可疑的导入,直到对模块的MATLAB调用成功
>重命名模块并重复(一旦成功加载,MATLAB必须重新启动以查看新更改)

我只需要这样做29次就可以隔离出以下有问题的sima输入.

上一篇:测序技术的学习


下一篇:Linux相当于Windows DLL转发器或MacOS reexport_library