2016-07-24 6 views
0

Ich habe das Internet für eine knappe Antwort auf diese Frage durchforstet, aber scheint nicht zu finden. Ich benutze Jupyter für Python 2 und versuche, matplotlib.pyplot vergeblich zu importieren. Dies ist der Code bei mir läuft:kann Matplotlib nicht importieren in Jupiter

import matplotlib.pyplot as plt 
%matplotlib inline 

und die Fehlermeldung, die ich erhalten wird:

--------------------------------------------------------------------------- 
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 

I Update matplotlib haben, numpy, scimath, scipy und anaconda Navigator (im Grunde aktualisiert alles, was ich könnte denken) und alles neu gestartet und ich bekomme immer noch diesen Fehler.

Entschuldigung, wenn das etwas Einfaches ist, habe ich verpasst, aber ich bin nicht sehr fähig, einige dieser Fehlermeldungen zu entschlüsseln.

Vielen Dank im Voraus.

Antwort

0

Es ist ‚bewirken, dass der numpy von Ihrer Enthought Vordach Verteilung wird mit dem numpy in Ihrer anaconda env und matplotlib Konflikt wurde gegen die enthought numpy wahrscheinlich gebaut, aber läuft gegen die Conda eines (oder umgekehrt ...)

Die einfachste Lösung ist die Deinstallation (oder Conda) und nur eine Deinstallation. Die härtere/unübersichtlichere Lösung besteht darin, den Enthought-Python von Ihrem sys.path & PythonPath zu stoßen, falls er existiert.

+0

Vielen Dank. Das hat mich schon einige Monate gestört. –

Verwandte Themen