Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Não consigo importar o matplotlib no jupyter

Não sei se me falta configurar algo no ambiente do jupyter pelo anaconda, mas quando insiro o comando:

%matplotlib inline import matplotlib.pyplot as plt plt.rc('figure', figsize = (20,10))

Me é reportado o seguinte erro:

ModuleNotFoundError Traceback (most recent call last) in ----> 1 get_ipython().run_line_magic('matplotlib', 'inline') 2 import matplotlib.pyplot as plt 3 plt.rc('figure', figsize = (20,10))

~\anaconda3\envs\alura_pandas\lib\site-packages\IPython\core\interactiveshell.py in run_line_magic(self, magic_name, line, stackdepth) 2324 kwargs['local_ns'] = sys.getframe(stackdepth).f_locals 2325 with self.builtin_trap: -> 2326 result = fn(args, *kwargs) 2327 return result 2328

~\anaconda3\envs\alura_pandas\lib\site-packages\decorator.py in fun(args, *kw) 230 if not kwsyntax: 231 args, kw = fix(args, kw, sig) --> 232 return caller(func, (extras + args), *kw) 233 fun.name = func.name 234 fun.doc = func.doc

~\anaconda3\envs\alura_pandas\lib\site-packages\IPython\core\magic.py in (f, a, *k) 185 # but it's overkill for just that one bit of state. 186 def magic_deco(arg): --> 187 call = lambda f, *a, *k: f(a, **k) 188 189 if callable(arg):

~\anaconda3\envs\alura_pandas\lib\site-packages\IPython\core\magics\pylab.py in matplotlib(self, line) 97 print("Available matplotlib backends: %s" % backends_list) 98 else: ---> 99 gui, backend = self.shell.enable_matplotlib(args.gui.lower() if isinstance(args.gui, str) else args.gui) 100 self.showmatplotlib_backend(args.gui, backend) 101

~\anaconda3\envs\alura_pandas\lib\site-packages\IPython\core\interactiveshell.py in enable_matplotlib(self, gui) 3417 """ 3418 from IPython.core import pylabtools as pt -> 3419 gui, backend = pt.find_gui_and_backend(gui, self.pylab_gui_select) 3420 3421 if gui != 'inline':

~\anaconda3\envs\alura_pandas\lib\site-packages\IPython\core\pylabtools.py in find_gui_and_backend(gui, gui_select) 278 """ 279 --> 280 import matplotlib 281 282 if gui and gui != 'auto':

ModuleNotFoundError: No module named 'matplotlib'

Alguém sabe me dizer se faltou, ou mudou algo, no Import da biblioteca do Matplotlib?

1 resposta
solução!

Olá Matheus, eu tive o mesmo problema e consegui consertar digitando o seguinte comando no terminal:

conda install matplotlib

Isso fará o download do pacote matplotlib em seu diretório anaconda. Espero ter ajudado, abraços.

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software