f2py on windows tutorials

Robert Kern robert.kern at gmail.com
Wed Sep 27 13:09:35 EDT 2006


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