4

ここの指示に従って最近 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
4

1 に答える 1

1

cygwinstartxwinターミナルに入力します (cygwin setup.exe から入手できる X11 ライブラリが必要です)。その後、新しいターミナル ウィンドウから実行して、新しいウィンドウを開くipython --pylabようなコマンドを実行できますが、プロットを呼び出す必要もあります。ネイティブ pylab とは異なり、cygwin のプロットのウィンドウの制御もネイティブ pylab に比べて貧弱です。plot(range(10))plt.draw()

このプロセスでセットアップ ファイルを編集する必要はありませんでした。必要なライブラリが cygwin setup.exe を介してインストールされるまで、'pip uninstall matplotlib' と再インストールが必要になる場合があります (tkinter と X11-devel ライブラリが必要だと思います)。 .

ez_setup.py から setuptools を取得します。

wget http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py
easy_install pip 
pip install numpy 
pip install ipython
pip install matplotlib
于 2013-04-21T00:37:49.460 に答える