我正在尝试在我的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
答案 0 :(得分:2)
在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,但它很残酷。
答案 1 :(得分:0)
创建一个virtualenv(我通常将我的全部放在桌面上)
下载pycrypto的二进制文件(匹配已安装的python版本和架构 - 目前不支持python3) - http://www.voidspace.org.uk/python/modules.shtml
导航到您创建的virtualenv文件夹中的easy_install可执行文件(位于Lib\site-packages
下)并运行pycrypto install:easy_install C:\path\to\the\download\pycrypto-2.6.win-amd64-py2.7.exe