无法在windows virtualen上安装pycrypto

2024-10-03 11:26:33 发布

您现在位置:Python中文网/ 问答频道 /正文

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


Tags: namefromiosrcbinincludelibtype
2条回答

我也遇到了同样的问题。 原因是在构建pycrypto时mingw32的gcc配置。 在configure中,gcc的设置-std设置为c99。 但是,当-std为c99时,将定义STRICT_Uansi_U,并跳过“sys/types.h”中的typedef\u offt off t和uoff64_t off64。 我通过修改mingw32中的sys/types.h成功地构建了pycrypto,但这很残酷。在

  1. 创建一个virtualenv(我通常把我的全部放在桌面上)

  2. 下载pycrypto的二进制文件(与安装的python版本和体系结构相匹配-目前不支持python3) -{/a1}

  3. 导航到您创建的virtualenv文件夹中的easy\u install可执行文件(位于Lib\site-packages)并运行pycrypto安装:easy_install C:\path\to\the\download\pycrypto-2.6.win-amd64-py2.7.exe

相关问题 更多 >