【发布时间】:2016-07-24 20:28:46
【问题描述】:
我已经在互联网上搜索了这个问题的简明答案,但似乎找不到。我正在将 jupyter 用于 python 2,并试图导入 matplotlib.pyplot 无济于事。 这是我正在运行的代码:
import matplotlib.pyplot as plt
%matplotlib inline
我收到的错误信息是:
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-5-385145dcc870> in <module>()
----> 1 import matplotlib.pyplot as plt
2 get_ipython().magic(u'matplotlib inline')
/Users/mbhall88/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/__init__.py in <module>()
120 # cbook must import matplotlib only within function
121 # definitions, so it is safe to import from it here.
--> 122 from matplotlib.cbook import is_string_like, mplDeprecation, dedent, get_label
123 from matplotlib.compat import subprocess
124 from matplotlib.rcsetup import (defaultParams,
/Users/mbhall88/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/matplotlib/cbook.py in <module>()
31 from weakref import ref, WeakKeyDictionary
32
---> 33 import numpy as np
34 import numpy.ma as ma
35
/Users/mbhall88/Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/numpy/__init__.py in <module>()
183 return loader(*packages, **options)
184
--> 185 from . import add_newdocs
186 __all__ = ['add_newdocs',
187 'ModuleDeprecationWarning',
/Users/mbhall88/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/mbhall88/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
我已经更新了 matplotlib、numpy、scimath、scipy 和 anaconda navigator(基本上更新了我能想到的所有内容)并重新启动了所有内容,但我仍然收到此错误。
抱歉,如果这是我错过的一些简单的事情,但我不是很能破译其中一些错误消息。
提前谢谢你。
【问题讨论】:
标签: python-2.7 numpy matplotlib jupyter