foo.f90python
subroutine hello (a) integer a write(*,*)'Hello from Fortran90!!!',a end subroutine hello
編譯linux
f2py -m foo -c foo.f90 shell
運行code
$ python Python 2.7.6 (default, Jun 22 2015, 17:58:13) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import foo >>> foo.hello(15) Hello from Fortran90!!! 15
若是python3則用orm
f2py2 -m foo -c foo.f90
這時編譯後產生foo.cpython-34m.so 而不是foo.soit