我正在尝试在Windows计算机上安装pycrypto。我已经安装了mingw,并且distutils正在使用它。这是我得到的错误:

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

编辑:我找到了这个,但是我不确定如何用它来修复pip安装。
http://ac-archive.sourceforge.net/largefile/largefiles_win32.print.html

最佳答案

在Windows中构建Fabric时遇到了相同的问题。
原因是在构建pycrypto时mingw32的gcc配置。
在configure中,gcc的设置-std设置为c99。
但是,当-std为c99时,将定义 __STRICT_ANSI__ ,并跳过“sys/types.h”中的typedef _off_t off_t和_off64_t off64_t。
我通过在mingw32中修改sys/types.h成功构建了pycrypto,但这很残酷。

关于python - 无法在Windows virtualenv上安装pycrypto,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/18554936/

10-13 03:22