LINK : fatal error LNK1104: cannot open file 'python27.lib'

Sivasubramaniam Arunachalam picture Sivasubramaniam Arunachalam · Apr 5, 2016 · Viewed 14.9k times · Source

I was trying to compile pycrypto-2.6.1 from source for Python 2.7.10 64-Bit Windows Version and facing the following error.

Processing pycrypto-2.6.1.tar.gz
Writing c:\users\sivasuba\appdata\local\temp\easy_install-ecznz_\pycrypto-2.6.1\setup.cfg
Running pycrypto-2.6.1\setup.py -q bdist_egg --dist-dir c:\users\sivasuba\appdata\local\temp\easy_install-ecznz_\pycrypto-2.6.1\egg-dist-tmp-us3gka
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
winrand.c
LINK : fatal error LNK1104: cannot open file 'python27.lib'
error: Setup script exited with error: command 'C:\\Users\\sivasuba\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\link.exe' failed with exit status 1104

Googling didn't help much. Any help on this would be appreciated.

P.S. I am not looking for pre-complied binaries. The requirement is to build it from source.

Answer

Yaron picture Yaron · Apr 5, 2016

It seems like your linker doesn't find python27.lib library.

LIB and LIBPATH are windows environment variables which are being used by the linker and compiler.

In which folder do you have python27.lib on your computer?

please confirm that LIB environment variable include the path for the python27.lib

If it didn't solve your problem - try adding python27.lib path also to LIBPATH