使用英特尔Fortran编译器的f2py

Tes*_*sla 6 fortran distutils f2py python-2.7 intel-fortran

我试图使用f2py将我的python程序与我的Fortran模块连接起来.

我在Win7平台上.

我使用最新的Anaconda 64(1.7)作为Python + NumPy堆栈.

My Fortran编译器是最新的Intel Fortran编译器64(版本14.0.0.103 Build 20130728).

我在执行时遇到了很多问题 f2py -c -m PyModule FortranModule.f90 --fcompiler=intelvem

最后一个,我似乎无法理清的是,看起来像f2py/distutils传递给编译器的标志序列与ifort所期望的不匹配.

调用ifort时,我收到一系列有关未知选项的警告消息.

ifort: command line warning #10006: ignoring unknown option '/LC:\Anaconda\libs'
ifort: command line warning #10006: ignoring unknown option'/LC:\Anaconda\PCbuild\amd64'
ifort: command line warning #10006: ignoring unknown option '/lpython27'
Run Code Online (Sandbox Code Playgroud)

我怀疑这与我最后从链接器获得的错误有关

error LNK2019: unresolved external symbol __imp_PyImport_ImportModule referenced in function _import_array
error LNK2019... and so forth (there are about 30-40 lines like that, with different python modules missing)
Run Code Online (Sandbox Code Playgroud)

它的结论很简单

fatal error LNK1120: 42 unresolved externals
Run Code Online (Sandbox Code Playgroud)

我的猜测是,这是因为选项序列中缺少/ link标志.因此,/ l/L选项不会传递给链接器,编译器认为这些选项是针对他的.

f2py生成的ifort命令如下所示:

ifort.exe -dll -dll Pymodule.o fortranobject.o FortranModule.o module-f2pywrappers2.o -LC:\Anaconda\libs -LC:\Anaconda\PCbuild\amd64 -lPython27
Run Code Online (Sandbox Code Playgroud)

我不知道为什么"-dll"会重复两次(我不得不从原来的"-shared"改变那个标志).

现在,我试图查看f2py和distutils代码,但还没有弄清楚如何在命令输出中提供额外的/链接.我甚至无法找到此输出的生成位置.

如果有人在过去遇到过这个问题和/或可能有一些建议,我会非常感激.

感谢您的时间

cup*_*cup 0

库路径是使用 /LIBPATH 而不是 /L 指定的