我正试图在我的Windows机器上安装pycrypto。我已经安装了mingw,distutils正在使用它。这里的错误是我得到的:
In file included from C:Python27include/pyconfig.h:68:0,
from C:Python27include/Python.h:8,
from src/winrand.c:33:
c:mingwbin../lib/gcc/mingw32/4.7.2/../../../../include/io.h:301:1: error: unknown type name 'off64_t'
c:mingwbin../lib/gcc/mingw32/4.7.2/../../../../include/io.h:301:36: error: unknown type name 'off64_t'
c:mingwbin../lib/gcc/mingw32/4.7.2/../../../../include/io.h:302:1: error: unknown type name 'off64_t'
c:mingwbin../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:mingwbin../lib/gcc/mingw32/4.7.2/../../../../include/_mingw.h:35:0,
from c:mingwbin../lib/gcc/mingw32/4.7.2/../../../../include/io.h:27,
from C:Python27include/pyconfig.h:68,
from C:Python27include/Python.h:8,
from src/winrand.c:33:
c:mingwbin../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时,定义了__STRECT_ANSI_,并跳过"sys/types.h"中的typedef_off_t off_t和_off64_t off64_t。我通过在mingw32中修改sys/types.h成功地构建了pycrypto,但这很残酷。
-
创建一个虚拟(我通常把我所有的都放在桌面上)
-
下载pycrypto的二进制文件(与您安装的python版本和架构匹配-目前不支持python3)-http://www.voidspace.org.uk/python/modules.shtml
-
导航到您创建的virtualenv文件夹中的easy_install可执行文件(位于
Libsite-packages
下),并运行pycrypto安装:easy_install C:pathtothedownloadpycrypto-2.6.win-amd64-py2.7.exe