我最近按照這裏的說明安裝了ipython:http://ardiyu07.blogspot.com/2012/04/ipython-012-installation-in-cygwin.html。
當我運行'ipython --pylab'
時,出現以下錯誤消息。我搜索了一下,發現了關於這個錯誤的帖子,但是在不同的上下文中。當我使用--pylab參數啓動ipython時會發生這種情況。我知道這與matplotlib gui交互有關,但不確定究竟是什麼。我很欣賞這個指導。
$ ipython --pylab
Python 2.7.3 (default, Dec 18 2012, 13:50:09)
Type "copyright", "credits" or "license" for more information.
IPython 0.13.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] GUI event loop or pylab initialization failed
---------------------------------------------------------------------------
TclError Traceback (most recent call last)
/usr/lib/python2.7/site-packages/IPython/core/interactiveshell.pyc in enable_pylab(self, gui, import_all)
2780 # Now we must activate the gui pylab wants to use, and fix %run to take
2781 # plot updates into account
-> 2782 self.enable_gui(gui)
2783 self.magics_manager.registry['ExecutionMagics'].default_runner = \
2784 mpl_runner(self.safe_execfile)
/usr/lib/python2.7/site-packages/IPython/lib/inputhook.pyc in enable_gui(gui, app)
526 e = "Invalid GUI request %r, valid ones are:%s" % (gui, guis.keys())
527 raise ValueError(e)
--> 528 return gui_hook(app)
529
/usr/lib/python2.7/site-packages/IPython/lib/inputhook.pyc in enable_tk(self, app)
322 if app is None:
323 import Tkinter
--> 324 app = Tkinter.Tk()
325 app.withdraw()
326 self._apps[GUI_TK] = app
/usr/lib/python2.7/lib-tk/Tkinter.pyc in __init__(self, screenName, baseName, className, useTk, sync, use)
1683 baseName = baseName + ext
1684 interactive = 0
-> 1685 self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
1686 if useTk:
1687 self._loadtk()
TclError: no display name and no $DISPLAY environment variable
setuptools的我不知道,如果是Tkinter的使用Cygwin兼容。你需要使用cygwin嗎?你可以在Windows上安裝IPython&matplotlib而不需要cygwin。 – 2013-03-24 18:56:35
感謝您的反饋。我對cygwin有其他依賴關係,這就是爲什麼我想保持與運行時環境一致的原因。帶有上面引用的安裝說明的網站似乎表明,ipython和matplotlib應該可以與cygwin一起工作,因爲這些說明適用於cygwin。 – codingknob 2013-03-24 20:05:30
看來您現在需要在Cygwin中爲tkinter安裝X11 - 鏈接的帖子可能使用的是舊版本。 http://cygwin.com/ml/cygwin/2012-02/msg00115.html – 2013-03-24 20:54:39