Greg
Greg

Reputation: 7383

Can't install pycrypto on windows virtualenv

I am trying to install pycrypto on my Windows machine. I have mingw installed and distutils is using it. The error here is what I am getting:

In file included from C:\Python27\include/pyconfig.h:68:0,

from C:\Python27\include/Python.h:8,

from src/winrand.c:33:

c:\mingw\bin../lib/gcc/mingw32/4.7.2/../../../../include/io.h:301:1: error: unknown type name 'off64_t'

c:\mingw\bin../lib/gcc/mingw32/4.7.2/../../../../include/io.h:301:36: error: unknown type name 'off64_t'

c:\mingw\bin../lib/gcc/mingw32/4.7.2/../../../../include/io.h:302:1: error: unknown type name 'off64_t'

c:\mingw\bin../lib/gcc/mingw32/4.7.2/../../../../include/io.h:302:39: error: unknown type name 'off64_t'

src/winrand.c:38:0: warning: "_WIN32_WINNT" redefined [enabled by default]

In file included from c:\mingw\bin../lib/gcc/mingw32/4.7.2/../../../../include/_mingw.h:35:0,

from c:\mingw\bin../lib/gcc/mingw32/4.7.2/../../../../include/io.h:27,

from C:\Python27\include/pyconfig.h:68,

from C:\Python27\include/Python.h:8,

from src/winrand.c:33:

c:\mingw\bin../lib/gcc/mingw32/4.7.2/../../../../include/sdkddkver.h:154:0: note: this is the location of the previous definition

error: command 'gcc' failed with exit status 1

Edit: I found this, but I am not sure how to fix pip install with it. http://ac-archive.sourceforge.net/largefile/largefiles_win32.print.html

Upvotes: 2

Views: 2644

Answers (2)

snassr
snassr

Reputation: 1548

  1. Create a virtualenv (I usually put all mine on the desktop)

  2. Download the binary of pycrypto (matching your installed python version and architecture - no support for python3 as of now) - http://www.voidspace.org.uk/python/modules.shtml

  3. navigate to the easy_install executable (under Lib\site-packages) within the virtualenv folder you created and run the pycrypto install: easy_install C:\path\to\the\download\pycrypto-2.6.win-amd64-py2.7.exe

Upvotes: 0

huckebein
huckebein

Reputation: 21

I met the same problem when building Fabric in windows. The reason was mingw32's gcc config when building pycrypto. In configure, gcc's setting -std is set to c99. But, when -std is c99, __STRICT_ANSI__ is defined and typedef _off_t off_t and _off64_t off64_t in "sys/types.h" are skipped. I succeeded to build pycrypto by modifying sys/types.h in mingw32 but it was brutal.

Upvotes: 2

Related Questions