[Tutor] Can not install pycrypto on Windows 64bit with cygwin(python27)

eryksun eryksun at gmail.com
Sat Sep 22 14:51:15 CEST 2012

On Sat, Sep 22, 2012 at 12:25 AM, Muse Gk <goknmuse at gmail.com> wrote:
> I had tried MinGW-w64 today, however, another more errors happen which
> just like this (
> http://stackoverflow.com/questions/6034390/compiling-with-cython-and-mingw-produces-gcc-error-unrecognized-command-line-o
> ). Another no solution error.
> First, I tried to remove all instances of -mno-cygwin in
> distutils\cygwinccompiler.py and got another different error.
> Second, keep -mno-cygwin in distutils\cygwinccompiler.py, tried a
> little version of  MinGW-w64 (
> http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/rubenvb/gcc-4.5-release/
> ). This time finally kill the error "gcc: error: unrecognized command
> line option '-mno-cygwin' ", however, got another one "collect2: ld
> returned 1 exit status" instead.

Which library caused the linker to fail?

Before running setup.py, add the following environment variable with
the "set" command:

    set LIBRARY_PATH=c:\pythonXX\libs

where XX is your version of Python (e.g. XX is 27 for Python 2.7).

Also, according to http://bugs.python.org/issue4709, you might need
MS_WIN64 to be manually defined. Try installing like this:

    python setup.py build_ext -DMS_WIN64 install

Alternatively, here's a Stack Overflow answer that links to
step-by-step instructions for using the compiler from the Windows 7


> It seems there is no way I can kill all errors. It took me hours and
> hours to kill those errors, however, there is still another one. I am
> feeling very depressed. I do not want to install pycrypto any more. :(
> I hope there will be an easy way to install it in the short future.

I doubt there will ever be an easy way considering export restrictions
on cryptography software. Plus you might feel just a bit more secure
building your own copy.

More information about the Tutor mailing list