此代码在我拥有的所有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