سؤال

I am using Enthought Canopy and recently upgraded both Scipy and numpy to the following: scipy: 0.13 build 2 numpy: 1.8 build 1

When I attempt:

from scipy import stats

I receive the following error:

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 

Not sure what has changed in the modules or if I need to import a different way.

هل كانت مفيدة؟

المحلول

Once you have imported numpy into the kernel, as is automatically done in ipython pylab mode which is enabled by default in Canopy, the kernel must be restarted if you want to import a new version. (No need to fully restart Canopy, just the kernel (see Run menu).

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top