在win 7 64位python上安装pybcrypt

2024-05-15 03:39:50 发布

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

正在尝试在win7上安装py bcrypt。Python是64位的。第一个错误找不到vcvarsall.bat。google了解到我需要安装mingw。现在安装这个

C:\tools\python_modules\py-bcrypt-0.2>python setup.py build -c mingw32
running build
running build_py
running build_ext
building 'bcrypt._bcrypt' extension
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -Ic:\Python27\include -Ic:\Python27\PC -c bcrypt/bcrypt_python.c -o b
d\temp.win-amd64-2.7\Release\bcrypt\bcrypt_python.o
bcrypt/bcrypt_python.c:29:26: error: expected declaration specifiers or '...' before 'u_int8_t'
bcrypt/bcrypt_python.c:29:38: error: expected declaration specifiers or '...' before 'u_int16_t'
bcrypt/bcrypt_python.c:29:49: error: expected declaration specifiers or '...' before 'u_int8_t'
bcrypt/bcrypt_python.c: In function 'bcrypt_encode_salt':
bcrypt/bcrypt_python.c:56:2: error: too many arguments to function 'encode_salt'
bcrypt/bcrypt_python.c:29:6: note: declared here
error: command 'gcc' failed with exit status 1

不知道下一步该怎么办。我想我不会用bcrypt再试试别的。还有其他建议吗?


Tags: orpybuildfunctionerrorrunningint8gcc
3条回答

我有同样的问题,我通过应用此链接上的修补程序修复了它:

http://code.google.com/p/py-bcrypt/issues/detail?can=2&start=0&num=100&q=&colspec=ID%20Type%20Status%20Priority%20Milestone%20Owner%20Summary&groupby=&sort=&id=1

py-bcrypt_11.补丁

必须手动应用。

从那条线索来看,问题的根源是

According to http://groups.google.com/group/mpir-devel/msg/2c2d4cc7ec12adbb (flags defined under the various windows OS'es ,cygwins,mingw's and other's) its better to use _WIN32 instead of _MSC_VER, Together with the change from bzero to memset this compiles both under MSVC and MingW32.

希望能有帮助!

我已经查看了bcrypt的源代码,但不明白为什么会出现这样的错误(目前没有Windows系统可供测试)。尽管查看pybcryptissue tracker看起来它还有其他Windows编译问题,所以可能不仅仅是您。不过,据猜测,通过额外的编译参数将“-std=C99”添加到gcc参数可能至少修复了一些错误。

除此之外,还有几个选择-

  • Bcryptor是另一个可以为您的系统编译的C扩展bcrypt实现。

  • Passlib是一个通用密码哈希库。虽然它依赖bcrypt or/pybcrypt来支持bcrypt,但它内置了对许多其他密码散列的支持,这些散列可能对您有用,例如SHA512-CryptPBKDF2-HMAC-SHA512

  • Cryptacular是另一个通用密码哈希库。在Windows上,它同时提供BCrypt和PBKDF2-HMAC-SHA512密码散列。(我会直接链接到这些,但文档不会让我这么做)

有一个py bcrypt for windows的编译版本。您可以访问https://bitbucket.org/alexandrul/py-bcrypt/downloads下载.exe文件并安装。

相关问题 更多 >

    热门问题