python - 无法在 Windows virtualenv 上安装 pycrypto

标签 python windows pycrypto

我正在尝试在我的 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 install 。 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/

相关文章:

python 将 RSA key (PEM 格式)转换为十六进制字符串

Python *args 属性错误

终端中的 Python 素数生成器

c++ - Win32 窗口创建失败?

Python AES解密例程(代码帮助)

Java-Python AES加密解密

python - LIBSVM 的多类表示

python - 仅将关键字参数传递给 __new__() 而永远不会将其进一步传递给 __init__()?

c - 结构如何保存在内存中 C

windows - PowerShell Windows 许可证类型