开发者社区> 问答> 正文

ipythonpylab在ubuntu中不能正常画图

没有用sudo apt-get update 和sudo apt-get upgrade 时,sudo apt-get install python-matplotlib 不能正常安装;update and upgrade 之后,可以正常安装python-matplotlib,ipython  numpy scipy   [size=; font-size: 0.95em,0.95em] [font=Consolas, 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace]imagemagick 之后,还是不能在  ipython --pylab 之下,使用plot画图,错误代码如下:
[size=; font-size: 0.95em,0.95em] [font=Consolas, 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace]


:~# ipython --pylab
Python 2.7.3 (default, Aug  1 2012, 05:14:39)
Type "copyright", "credits" or "license" for more information.


IPython 0.12.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.


Welcome to pylab, a matplotlib-based Python environment [backend: TkAgg].
For more information, type 'help(pylab)'.
[TerminalIPythonApp] Error in enabling GUI event loop integration:
---------------------------------------------------------------------------
TclError                                  Traceback (most recent call last)
/usr/lib/python2.7/dist-packages/IPython/core/interactiveshell.pyc in enable_pylab (self, gui, import_all)
   2600          # Now we must activate the gui pylab wants to use, and fix %run to take


   2601          # plot updates into account


-> 2602          self .enable_gui (gui )
   2603         self .magic_run = self ._pylab_magic_run
   2604


/usr/lib/python2.7/dist-packages/IPython/lib/inputhook.pyc in enable_gui (gui, app)
    480          e = "Invalid GUI request %r, valid ones are:%s" % ( gui, guis. keys())
    481         raise ValueError (e )
--> 482      return gui_hook ( app )
    483


/usr/lib/python2.7/dist-packages/IPython/lib/inputhook.pyc in enable_tk (self, app)
    306         if app is None :
    307             import Tkinter
--> 308              app = Tkinter .Tk ()
    309             app .withdraw ()
    310             self ._apps [GUI_TK ] = app


/usr/lib/python2.7/lib-tk/Tkinter.pyc in __init__(self, screenName, baseName, className, useTk, sync, use)
   1686                 baseName = baseName + ext
   1687         interactive = 0
-> 1688          self .tk = _tkinter .create (screenName , baseName , className , interactive , wantobjects , useTk , sync , use )
   1689         if useTk :
   1690             self ._loadtk ()


TclError: no display name and no $DISPLAY environment variable


In [ 1]:

展开
收起
oul 2014-04-13 07:27:19 8800 0
1 条回答
写回答
取消 提交回答
  • Reipythonpylab在ubuntu中不能正常画图
    TclError: no display name and no $DISPLAY environment variable
    -----你需要安装桌面组件包
    2014-04-14 11:59:52
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载