[英]Jupyter QtConsole syntaxerror with matplotlib inline
好的,我已经遇到这个问题已有一段时间了,我很茫然。
我正在运行Jupyter QtConsole并尝试运行python脚本。
from __future__ import division
from ipywidgets import *
import numpy as np
import matplotlib.pyplot as p
%matplotlib inline
QtConsole一直给我一个错误:
run test.py
File "/home/Bob/Desktop/test.py", line 5
%matplotlib inline
^
SyntaxError: invalid syntax
从我读到的这是Ipython特定代码,它应该在Jupyter QtConsole中工作,我通过转到终端并输入:
bob@bob-laptop:~/Desktop$ jupyter qtconsole
它在终端中给出了这个,但随后加载了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))
请帮忙。
启动qtconsole后,在控制台上内联键入%matplotlib,之后所有图将内联显示。
希望这可以帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.