GD/gdmodule on Win XP

John Hunter jdhunter at ace.bsd.uchicago.edu
Mon Feb 2 18:24:21 EST 2004


>>>>> "Eduardo" == Eduardo Elgueta <eelgueta at navix.cl> writes:

    Eduardo> Hi All, I'm trying to setup matplotlib
    Eduardo> (http://matplotlib.sourceforge.net/) in a Win XP box.

gdmodule is difficult to install on windows (as you've discovered).
Fortunately, Stefan Kuzminski figured this out and built a statically
linked gd module - no need to download gd lib or freetype, etc.  Here
are the compile notes he posted to the matplotlib-users mailing list

  http://sourceforge.net/mailarchive/message.php?msg_id=7064914

and here is a link to the dll; just put this in your site-packages dir.

  http://matplotlib.sourceforge.net/gd/_gd.dll

You will also need to place gd.py from the gdmodule-0.51 distro in
site-packages.   After that you should be able to do

  > python
  >>> import gd

IMPORTANT - I've been doing a lot of development on the gd backend of
late and the latest version of matplotlib requires a patched version
of gdmodule (which will become included in the standard gdmodule at
the next release).  So the DLL linked above *will not* work with
matplotlib-0.50.  Thus you will need to either:
   
   * downgrade to matplotlib-0.42.2 -
     http://sourceforge.net/project/showfiles.php?group_id=80706

   * build the patched gdmodule using
     http://matplotlib.sourceforge.net/gd/_gdmodule.c.  If you do
     this, you can take advantage of the improvements made in the gd
     backend subsequent to 0.42.2.  Please mail me a copy of the DLL
     if you succeed with any compile notes.

Of course you still need to the prerequisites described on
http://matplotlib.sourceforge.net/backends.html#GD, but gdmodule is
definitely the tough nut to crack on win32.

I haven't built fonttools for win32 in some time, so if someone else
can pipe in and share their insights I'd be happy.  I found the TTX
installer on the sourceforge site, but this doesn't seem to provide
the python fontools package.

With the prereqs installed, you can test your setup with

  import matplotlib
  matplotlib.use('GD')
  from matplotlib.matlab import *
  plot([1,2,3])
  savefig('gdtest')

Good luck!
John Hunter




More information about the Python-list mailing list