Windows 10 Home 64-bit(10.0, build 14393)
Python 3.5.2 |Anaconda 4.1.1 (64-bit)|
Intel Parallel Studio XE 2017
I try to follow the example in f2py user guide and launch cmd
in local directory and type the following
f2py -c fib1.f -m fibtest
and everything seems OK until
Found executable C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe
LINK : fatal error LNK1104: cannot open file 'ifconsol.lib'
error: Command "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\x86_amd64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:C:\Anaconda3\libs /LIBPATH:C:\Anaconda3\PCbuild\amd64 /LIBPATH:C:\Anaconda3\libs /LIBPATH:C:\Anaconda3\PCbuild\amd64 /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB\amd64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\lib\um\x64" /LIBPATH:"C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x64" /EXPORT:PyInit_fibtest C:\Users\FRANKH~1\AppData\Local\Temp\tmpxmd8uex9\Release\Users\FRANKH~1\AppData\Local\Temp\tmpxmd8uex9\src.win-amd64-3.5\fibtestmodule.obj C:\Users\FRANKH~1\AppData\Local\Temp\tmpxmd8uex9\Release\Users\FRANKH~1\AppData\Local\Temp\tmpxmd8uex9\src.win-amd64-3.5\fortranobject.obj C:\Users\FRANKH~1\AppData\Local\Temp\tmpxmd8uex9\Release\fib1.o /OUT:.\fibtest.cp35-win_amd64.pyd /IMPLIB:C:\Users\FRANKH~1\AppData\Local\Temp\tmpxmd8uex9\Release\Users\FRANKH~1\AppData\Local\Temp\tmpxmd8uex9\src.win-amd64-3.5\fibtest.cp35-win_amd64.lib" failed with exit status 1104
The error:
was added 9/27/2016 for more info.
I notice that the path after error:
is all in a C:
while my intel fortran is installed in a D:
, I guess it's the point to blame?
This problem seems identical to the last comment in F2PY cannot find intel fortran compiler on windows 7, so I tried the ways there by typing
f2py -c fib1.f -m fibtest -L"D:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.0.109\windows\compiler\lib\intel64"
and it did work.
By myself, I try to launch the cmd from Compiler 17.0 for Intel 64 Visual Studio 2015 environment, which is found in intel directory in the start menu.
After redirecting to the directory of fib1.f, simply typing
f2py -c fib1.f -m fibtest
also works good.
So, is there a better way to solve the problem so that I can do the work in a locally launched cmd with a simple typing?
The following was added 9/27/2016 after checking the answer from Steve:
I believe the shortcut is the same as my second tried solution and the call "%IFORT_COMPILER17%bin\ifortvars.bat" intel64
did offer me an alternative while I'm still wondering an automatic solution.
You need to set up the Intel Fortran environment somehow. The easiest way is to use the shortcut that gets installed. But if you type this once in your command window it should allow you to omit the -L option later:
call "%IFORT_COMPILER17%bin\ifortvars.bat" intel64
You will have established the environment correctly.