【问题标题】:How can I import odeint and arange in Python?如何在 Python 中导入 odeint 和 arange?
【发布时间】:2016-05-14 11:56:08
【问题描述】:

我正在尝试通过以下方式在 python 中导入 odeint:

from scipy.integrate import odeint

但是有错误提示:

ImportError: 没有名为 scipy.integrate 的模块

我浏览了一些网站,有一个名为 scipy.integrate 的模块,我不确定我的代码出了什么问题?

我也试过

from scipy import arange

其中也显示了类似的错误信息:

ImportError: 没有名为 scipy 的模块

我使用的是 Python 2.7.8。是因为Python的版本吗?那我该如何解决呢?

如果我什至无法导入它们,我将无法继续编写我的代码。

有人可以给点建议吗?

谢谢。

【问题讨论】:

  • 嗯,你安装 scipy了吗?在同一个解释器/环境中?它不包含在标准库中。

标签: python python-2.7 scipy python-import importerror


【解决方案1】:

当未安装 scipy 时会发生这种情况。

Scientific Python 下载并安装 SciPy

Ubuntu 和 Debian:sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose

Fedora:sudo yum install numpy scipy python-matplotlib ipython python-pandas sympy python-nose

窗口:Unofficial Windows Binaries for Python Extension Packages

SciPy source

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-28
    • 2023-01-26
    • 2014-05-26
    • 2016-05-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多