Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 887
Sivasubramaniam Arunachalam Avatar asked Apr 05 '16 07:04

Sivasubramaniam Arunachalam


2 Answers

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

like image 109
Yaron Avatar answered Oct 12 '22 00:10

Yaron


Doing the following worked for me:

  1. python27.lib is located in 'libs' folder under Python27 (folder where python is installed on windows) enter image description here
  2. Add 'LIB' environment variable to the that points to the directory/folder containing python27.lib library:

enter image description here

like image 31
javed Avatar answered Oct 12 '22 02:10

javed