簡體   English   中英

使用Matplotlib內聯的Jupyter QtConsole語法錯誤

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM