【发布时间】:2017-07-04 01:45:12
【问题描述】:
此代码在我拥有的所有 Python 环境中都失败,但在 Spyder 中没有:
import scipy
print(scipy.integrate.cumtrapz([1, 2, 3]))
在大多数环境中你会得到
AttributeError: module 'scipy' has no attribute 'integrate'
除非您使用import scipy.integrate 来导入子模块,但不知何故,在 Spyder 中,如果您使用“在当前 Python 或 IPython 控制台中执行”运行配置,则此代码运行不会出错。如果您使用“在新的专用 Python 控制台中执行”,它会失败。显然 Spyder 正在做一些事情来自动导入子模块,但我在任何地方都找不到这种行为。
问题是 Spyder 在做什么、在哪里记录以及如何关闭它。
环境:Anaconda 3 (4.3.0)、Spyder 3.1.2、Python 3.5
【问题讨论】: