0

I am using the terminal in jupyter and am trying to plot with matplotlib. I need to plot inline and so i use %matplotlib inline but i am getting the following error:

>>> %matplotlib inline
  File "<stdin>", line 1
    %matplotlib inline
    ^
SyntaxError: invalid syntax

Why am i getting this error? Is it because it is a terminal and not jupyter notebook type environment? I had tried the same code in jupyter notebook and it did not return any errors.

1
  • 2
    Yes, %whatever is an IPython magic command, which will only work in IPython (Jupyter uses IPython kernel by default). Commented Jan 4, 2020 at 18:12

2 Answers 2

1

You should run ipython instead of python in the Jupyter terminal. Then you can execute any magic command.

Sign up to request clarification or add additional context in comments.

2 Comments

I tried running ipython and got this error: UnknownBackend: No event loop integration for 'inline'. Supported event loops are: qt, qt4, qt5, gtk, gtk2, gtk3, tk, wx, p yglet, glut, osx
0

trying using 'exec(%matplotlib inline)'. Works for me on python3.6

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.