【问题标题】:ImportError: No module named array_import -----scipyImportError: No module named array_import -----scipy
【发布时间】:2011-10-19 07:23:29
【问题描述】:

我在 scipy 中导入 io 模块时遇到问题 和 python shell 显示如下错误。

import scipy.io.array_import

ImportError: No module named array_import

请告诉我如何解决这个问题。

通过阅读网上的一些帖子,我也尝试使用

import numpy.loadtxt  

但这也行不通

ImportError: 没有名为 loadtxt 的模块

【问题讨论】:

  • loadtxt 不是模块

标签: python numpy scipy


【解决方案1】:

请参阅 SciPy 用户邮件列表中的 this message

scipy 中导入io 模块时遇到问题 和 python shell 显示如下错误。

import scipy.io.array_import
ImportError: No module named array_import

array_import 在 Scipy 0.8 中被删除。如果您正在寻找 read_array 和 write_array,你应该使用numpy.savetxtnumpy.loadtxt 代替。

【讨论】:

    【解决方案2】:

    numpy.loadtxt 是一个函数,而不是一个模块。这就是为什么你不能导入loadtxt

    In [33]: import numpy
    In [34]: numpy.loadtxt
    Out[34]: <function loadtxt at 0x9f8bca4>
    

    【讨论】:

    • from numpy import loadtxt
    猜你喜欢
    • 2016-08-09
    • 2017-04-19
    • 1970-01-01
    • 2015-09-10
    • 2012-08-12
    • 2018-01-19
    • 1970-01-01
    • 1970-01-01
    • 2014-07-30
    相关资源
    最近更新 更多