MATLAB为什么无法导入此python库?
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了MATLAB为什么无法导入此python库?,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含4115字,纯文字阅读大概需要6分钟。
内容图文
我想在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输入.
内容总结
以上是互联网集市为您收集整理的MATLAB为什么无法导入此python库?全部内容,希望文章能够帮你解决MATLAB为什么无法导入此python库?所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。