在为python编译f2py模块时遇到一些麻烦。我使用python 3.6运行Windows 10 64位,我使用以下代码:
from numpy.distutils.core import Extension
ext = Extension(name = 'Sigma',
sources = ['Sigma.f95'])
if __name__ == "__main__":
from numpy.distutils.core import setup
setup(name = 'f2py_example',
ext_modules =[ext])
从以下fortran代码生成python模块:
subroutine Test(Su, A, B)
real :: A, B, Su
!f2py intent(in) a
!f2py intent(in) b
!f2pu intent(out) Su
Su = A + B
end subroutine
使用lib.win-amd64-3.6
中的以下文件生成构建文件:
Sigma.cp36-win_amd64.pyd
然而,当我尝试导入它然后使用Import Sigma
时,我收到以下错误:
Traceback (most recent call last):
File "C:\Users\heele\Desktop\Learning Fortran\Plot.py", line 1, in <module>
import Sigma
ImportError: DLL load failed: The specified module could not be found.
[Finished in 0.2s with exit code 1]
任何人都可以帮我吗?它是否意味着生成我缺少的DLL文件?