matplotlib – 关于cygwin的ipython –pylab:TclError:没有显示名称和没有$DISPLAY环境变量

matplotlib – 关于cygwin的ipython –pylab:TclError:没有显示名称和没有$DISPLAY环境变量,第1张

概述我最近按照说明安装了i python: http://ardiyu07.blogspot.com/2012/04/ipython-012-installation-in-cygwin.html. 当我运行’ipython –pylab’时,我收到以下错误消息.我已经google了一下,发现有关此错误的帖子,但在不同的背景下.当我使用–pylab参数启动ipython时会出现.我知道这与matplo 我最近按照说明安装了i python: http://ardiyu07.blogspot.com/2012/04/ipython-012-installation-in-cygwin.html.

当我运行’ipython –pylab’时,我收到以下错误消息.我已经Google了一下,发现有关此错误的帖子,但在不同的背景下.当我使用–pylab参数启动ipython时会出现.我知道这与matplotlib gui交互有关,但不确定究竟是什么.我很欣赏这个指导.

$ipython --pylabPython 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,interactive,wantobjects,use)   1686         if useTk:   1687             self._loadtk()TclError: no display name and no $disPLAY environment variable
解决方法 在cygwin终端输入startxwin(你需要从cygwin setup.exe获得X11库)然后你可以从新的终端窗口运行ipython –pylab和一个命令,如plot(range(10)),这将打开一个新的窗口,但你需要调用plt.draw()来显示与原生pylab不同的绘图,与原生pylab相比,对cygwin中的绘图窗口的控制也很差.

我不需要在此过程中编辑任何设置文件,您可能需要’pip uninstall matplotlib’并重新安装,直到您通过cygwin setup.exe安装了所需的库(tkinter,我相信需要X11-devel库) .

通过ez_setup.py获取setuptools

wget http://peak.telecommunity.com/dist/ez_setup.pypython ez_setup.pyeasy_install pip pip install numpy pip install ipythonpip install matplotlib
总结

以上是内存溢出为你收集整理的matplotlib – 关于cygwin的ipython –pylab:TclError:没有显示名称和没有$DISPLAY环境变量全部内容,希望文章能够帮你解决matplotlib – 关于cygwin的ipython –pylab:TclError:没有显示名称和没有$DISPLAY环境变量所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/langs/1196824.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-03
下一篇 2022-06-03

发表评论

登录后才能评论

评论列表(0条)

保存