简体   繁体   中英

Jupyter QtConsole syntaxerror with matplotlib inline

Ok I have been at this problem for some time now, and I am at a loss.

I am running Jupyter QtConsole and trying to run a python script.

from __future__ import division
from ipywidgets import *
import numpy as np
import matplotlib.pyplot as p
%matplotlib inline

The QtConsole keeps giving me an error:

run test.py
  File "/home/Bob/Desktop/test.py", line 5
    %matplotlib inline
    ^
SyntaxError: invalid syntax

From what I read this is Ipython specific code and it should work in the Jupyter QtConsole which I load by going to terminal and typing:

bob@bob-laptop:~/Desktop$ jupyter qtconsole

It gives this in the terminal but then loads the qtconsole.

/usr/local/lib/python2.7/dist-packages/IPython/paths.py:62: UserWarning: IPython dir '/home/bob/.ipython' is not a writable location, using a temp directory.
  " using a temp directory.".format(ipdir))
Bus::open: Can not get ibus-daemon's address. 
IBusInputContext::createInputContext: no connection to ibus-daemon 
/usr/local/lib/python2.7/dist-packages/IPython/paths.py:62: UserWarning: IPython dir '/home/bob/.ipython' is not a writable location, using a temp directory.
  " using a temp directory.".format(ipdir))

Please Help.

Once you start qtconsole, type %matplotlib inline on the console and there after all the plots will appear inline.

Hope this helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM