简体   繁体   中英

Loading matplotlib on cygwin

To load matplotlib on cygwin, I have:

  1. Loaded pre-requisites using cygwin 64-bit setup: 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

  3. Then built and installed matplotlib:

    $ python setup.py build
    $ python setup.py install

And am down to what looks like a matplotlib backend error. 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

EDIT: I just finally got it and matplotlib is finally working on cygwin. To do this, I did:

  1. From cygwin setup, loaded the X-Server tools: 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

  3. I set my display:

    DISPLAY=":0.0"
    export DISPLAY

  4. From the cygwin shell, I did:

    $ startxwin

  5. Then I ran my python scripts which use matplotlib in the X-window

I had an issue with "python setup.py build" not finding the ft2build.h which comes from the the freetype2 package. I installed the freetype2 development package and I can find it in /usr/include/freetype2/ft2build.h but the error is still there. 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. Hence it could not find "/usr/include/ft2build.h" when it should be "/usr/include/freetype2/ft2build.h Fixing this line #134

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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