【问题标题】:Trouble importing scipy.stats for scipy 0.13 build 2为 scipy 0.13 build 2 导入 scipy.stats 时遇到问题
【发布时间】:2013-12-09 02:37:15
【问题描述】:

我正在使用 Enthought Canopy,最近将 Scipy 和 numpy 升级到以下版本: scipy:0.13 构建 2 numpy:1.8 构建 1

当我尝试时:

from scipy import stats

我收到以下错误:

NameError                                 Traceback (most recent    call last)
<ipython-input-123-9d55e67ee92d> in <module>()
----> 1 from scipy import stats

C:\Users\M\AppData\Local\Enthought\Canopy\User\lib\site-    packages\scipy\__init__.py in <module>()
 75 # Import numpy symbols to scipy name space
 76 import numpy as _num
---> 77 from numpy import oldnumeric
 78 from numpy import *
 79 from numpy.random import rand, randn

C:\Users\M\AppData\Local\Enthought\Canopy\User\lib\site-packages\numpy\oldnumeric\__init__.py in <module>()
  9 
 10 _msg = "The oldnumeric module will be dropped in Numpy 1.9"
---> 11 warnings.warn(_msg, ModuleDeprecationWarning)
 12 
 13 

NameError: name 'ModuleDeprecationWarning' is not defined 

不确定模块中发生了什么变化,或者我是否需要以不同的方式导入。

【问题讨论】:

  • 我相信我能够通过在 scipy 和 numpy 更新后重新启动树冠来解决这个问题。试图在不重新启动的情况下运行代码似乎是导致错误的原因。

标签: python numpy scipy canopy


【解决方案1】:

一旦你将 numpy 导入内核,就像在 Canopy 默认启用的 ipython pylab 模式下自动完成的那样,如果你想导入新版本,必须重新启动内核。 (无需完全重启 Canopy,只需重启内核(参见运行菜单)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-11-18
    • 2012-01-07
    相关资源
    最近更新 更多