f2py on windows tutorials

Flavio fccoelho at gmail.com
Wed Sep 27 13:45:42 EDT 2006


Hi Robert,

Putting the .pyf first didn't do any good. I still get the same error
message of unknown file type

However when I try to compile with f2py, all works perfectly! here is
the command I used:

f2py -c flib.pyf flib.f --compiler=mingw32 --fcompiler=gnu

Note: if I use mingw instead of mingw32  it does not work!!

So all that remains now is to be able to do it from the setup.py...

thanks again...

Robert Kern wrote:
> Flavio wrote:
> > Ok,
> >
> > I tried that and it seems we are making progress
> >
> > so here is my command:
> >
> > python setup.py build_ext --compiler=mingw32 --fcompiler=gnu
> >
> > Now it is complaining about my pyf!!
> >
> > error: unknown file type '.pyf'
> >
> > here is my setup .py:
> >
> > import setuptools, os
> > from numpy.distutils.core import setup, Extension
> >
> > #Configuring Build
> > libs=[];libdirs=[];f2pyopts=[]
> > if os.name == 'nt':
> >     f2pyopts.extend(["--compiler=mingw32","--fcompiler=gnu"])
>
> These don't belong here. If you don't want to type them in at the command line,
> put them in a setup.cfg file next to your setup.py:
>
>
> [build_ext]
> compiler=mingw
> fcompiler=gnu
>
>
> (Note: "mingw", not "mingw32"!)
>
> > flib = Extension(name='flib',
> >                         libraries=libs,
> >                         library_dirs=libdirs,
> >                         f2py_options=f2pyopts,
> >
> > sources=['model-builder/Bayes/flib.f','model-builder/Bayes/flib.pyf',]
>
> The .pyf file needs to come first.
>
> --
> Robert Kern
>
> "I have come to believe that the whole world is an enigma, a harmless enigma
>   that is made terrible by our own mad attempt to interpret it as though it had
>   an underlying truth."
>    -- Umberto Eco




More information about the Python-list mailing list