title: error LNK1104 : cannot open file 'ifconsol.lib' using f2py and Intel Fortran
body: <h1>System Info</h1>
  
  <p>Windows 10 Home 64-bit(10.0, build 14393)</p>
  
  <p>Python 3.5.2 |Anaconda 4.1.1 (64-bit)|</p>
  
  <p>Intel Parallel Studio XE 2017</p>
  
  <h1>Problem Encountered</h1>
  
  <p>I try to follow the example in f2py user guide and launch <code>cmd</code> in local directory and type the following</p>
  
  <pre><code>f2py -c fib1.f -m fibtest
  </code></pre>
  
  <p>and everything seems OK until</p>
  
  <pre><code>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
  </code></pre>
  
  <p>The <code>error:</code> was added 9/27/2016 for more info.</p>
  
  <p>I notice that the path after <code>error:</code> is all in a <code>C:</code> while my intel fortran is installed in a <code>D:</code>, I guess it's the point to blame?</p>
  
  <h1>Tried Solutions</h1>
  
  <p>This problem seems identical to the last comment in <a href="https://stackoverflow.com/questions/37776876/f2py-cannot-find-intel-fortran-compiler-on-windows-7">F2PY cannot find intel fortran compiler on windows 7</a>, so I tried the ways there by typing</p>
  
  <pre><code>f2py -c fib1.f -m fibtest -L"D:\Program Files (x86)\IntelSWTools\compilers_and_libraries_2017.0.109\windows\compiler\lib\intel64"
  </code></pre>
  
  <p>and it did work.</p>
  
  <p>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.</p>
  
  <p>After redirecting to the directory of fib1.f, simply typing </p>
  
  <pre><code>f2py -c fib1.f -m fibtest
  </code></pre>
  
  <p>also works good.</p>
  
  <p>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?</p>
  
  <p>The following was added 9/27/2016 after checking the answer from Steve:</p>
  
  <p>I believe the shortcut is the same as my second tried solution and the <code>call "%IFORT_COMPILER17%bin\ifortvars.bat" intel64</code> did offer me an alternative while I'm still wondering an automatic solution.</p>