hello.for subroutine hello(x) implicit none integer x write (*, *) "Hello from fortran.", x end subroutine hello test1.py # -*- coding: utf-8 -*- import hello hello.hello(2018) 编译 f2py3 -c hello.for -m hello 运行 python test1.py 屏幕输出结果 为 Hello from fortran. 2018