简体   繁体   English

在Cygwin上加载Matplotlib

[英]Loading matplotlib on cygwin

To load matplotlib on cygwin, I have: 要在cygwin上加载matplotlib,我需要:

  1. Loaded pre-requisites using cygwin 64-bit setup: pkg-config, freetype2, libfreetype-devel, libpng-devel, gtk2.0, libgtk2.0-devel 使用cygwin 64位设置加载的先决条件:pkg-config,freetype2,libfreetype-devel,libpng-devel,gtk2.0,libgtk2.0-devel

  2. Downloaded the matplotlib tar file ( http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.3.1/matplotlib-1.3.1.tar.gz ) and changed the source code to get around the "_tri" error as advised here: matplotlib error while installing pyspeckit 下载了matplotlib tar文件( http://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.3.1/matplotlib-1.3.1.tar.gz ),并更改了源代码以避开“ _tri”此处建议的错误: 安装pyspeckit时出现matplotlib错误

  3. Then built and installed matplotlib: 然后构建并安装matplotlib:

    $ python setup.py build $ python setup.py构建
    $ python setup.py install $ python setup.py安装

And am down to what looks like a matplotlib backend error. 并且归结为看起来像matplotlib后端错误的东西。 Does anyone know how to get around this: 有谁知道如何解决这个问题:

/usr/lib/python2.7/site-packages/gtk-2.0/gtk/ init .py:57: GtkWarning: could not open display ... cursors.MOVE : gdk.Cursor(gdk.FLEUR), et n RuntimeError: could not create GdkCursor object /usr/lib/python2.7/site-packages/gtk-2.0/gtk/ init .py:57:GtkWarning:无法打开显示... cursors.MOVE:gdk.Cursor(gdk.FLEUR),et RuntimeError :无法创建GdkCursor对象

EDIT: I just finally got it and matplotlib is finally working on cygwin. 编辑:我终于得到它,并且matplotlib终于在cygwin上工作。 To do this, I did: 为此,我做了:

  1. From cygwin setup, loaded the X-Server tools: xorg-server xinit 从cygwin设置中,加载了X-Server工具:xorg-server xinit

  2. From cygwin setup, I also loaded these so that use telnet or ssh connections to run remote X clients: inetutils openssh 从cygwin设置中,我还加载了这些文件,以便使用telnet或ssh连接运行远程X客户端:inetutils openssh

  3. I set my display: 我设置了显示:

    DISPLAY=":0.0" DISPLAY = “:0.0”
    export DISPLAY 汇出DISPLAY

  4. From the cygwin shell, I did: 从cygwin外壳程序中,我执行了以下操作:

    $ startxwin $ startxwin

  5. Then I ran my python scripts which use matplotlib in the X-window 然后我运行了在X窗口中使用matplotlib的python脚本

I had an issue with "python setup.py build" not finding the ft2build.h which comes from the the freetype2 package. 我遇到“ python setup.py build”问题,但找不到来自freetype2软件包的ft2build.h。 I installed the freetype2 development package and I can find it in /usr/include/freetype2/ft2build.h but the error is still there. 我安装了freetype2开发包,可以在/usr/include/freetype2/ft2build.h中找到它,但错误仍然存​​在。 After digging into the setupext.py at the function check_include_file(include_dirs, filename, package), I noticed that the package="freetype2" was not concatenated into to the search path. 在功能check_include_file(include_dirs,文件名,包)处进入setupext.py后,我注意到package =“ freetype2”没有连接到搜索路径中。 Hence it could not find "/usr/include/ft2build.h" when it should be "/usr/include/freetype2/ft2build.h Fixing this line #134 因此,当它应为“ /usr/include/freetype2/ft2build.h”时,找不到“ /usr/include/ft2build.h”。修复此行#134

if not has_include_file(include_dirs, "%s/%s"%(package,filename)):

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM