使用iPython Notebook

时间:2015-05-28 06:59:55

标签: python ipython-notebook

我正在尝试学习如何使用iPython笔记本,并且遇到导入numpy或matplotlib的问题。当我尝试将单元格作为

import matplotlib.pyplot as plt
import numpy as np

并按shift + enter:我返回错误:

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-11-deb84735ddff> in <module>()
----> 1 import matplotlib.pyplot as plt
      2 import numpy as np

/Users/jakehuneau/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/__init__.py in <module>()
    177 # cbook must import matplotlib only within function
    178 # definitions, so it is safe to import from it here.
--> 179 from matplotlib.cbook import is_string_like
    180 from matplotlib.compat import subprocess
    181 

/Users/jakehuneau/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/cbook.py in <module>()
     30 from weakref import ref, WeakKeyDictionary
     31 
---> 32 import numpy as np
     33 import numpy.ma as ma
     34 

/Users/jakehuneau/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/__init__.py in <module>()
    166         return loader(*packages, **options)
    167 
--> 168     from . import add_newdocs
    169     __all__ = ['add_newdocs', 'ModuleDeprecationWarning']
    170 

/Users/jakehuneau/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/add_newdocs.py in <module>()
     11 from __future__ import division, absolute_import, print_function
     12 
---> 13 from numpy.lib import add_newdoc
     14 
     15 ###############################################################################

/Users/jakehuneau/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/lib/__init__.py in <module>()
     15 from .ufunclike import *
     16 
---> 17 from . import scimath as emath
     18 from .polynomial import *
     19 #import convertcode

ImportError: cannot import name scimath

为什么会发生这种情况,我该如何解决?

1 个答案:

答案 0 :(得分:0)

尝试sudo pip install scimath

如果它不起作用,那么检查一下它应该有帮助:

scipy with enthought canopy