[Numpy-discussion] extension questions: f2py and cython

Andrew Hawryluk HAWRYLA@novachem....
Thu Oct 15 10:24:03 CDT 2009

> -----Original Message-----
> From: numpy-discussion-bounces@scipy.org [mailto:numpy-discussion-
> bounces@scipy.org] On Behalf Of Robin
> Sent: 15 Oct 2009 6:54 AM
> To: numpy-discussion@scipy.org
> Subject: Re: [Numpy-discussion] extension questions: f2py and cython
> Hi,
> I have another question about distributing a Python extension which
> uses f2py wrapped code. Ideally I'd like to keep pure Python/Numpy
> alternatives and just use fortran version if available - but I think
> that should be OK.
> I'm more worried about distributing binaries on Windows - I think on
> Mac/Linux it would be ok to have a fortran compiler required and build
> it - but on Windows I guess one should really distribute binaries.
> What is the recommended (free) fortran 95 compiler for use with f2py
> windows (gfortan with cygwin?) Is it possible to get f2py to build a
> static library on windows so I can just distribute that? Or will I
> to include library files from the compiler?

I am using gfortran, which has a native Windows installer:

I have also successfully used g95 with f2py on Windows.

When f2py runs this on Windows, it produces a *.pyd file that contains
the compiled code. E.g. myfoo.f --> myfoo.pyd. This is imported into
python with 'import myfoo'. The recipient of the windows binary needs
only the *.pyd file (and your *.py files).


More information about the NumPy-Discussion mailing list