在Windows(x64)上安装Python bcrypt遇到多种问题

5 投票
2 回答
2219 浏览
提问于 2025-04-17 00:28

这个问题在其他地方也提到过,但没有提供一个有效的解决方案,所以我还是想保持这个问题的讨论。

c:\Users\me\Desktop\temp\py-bcrypt-0.2>setup.py install build --compiler=min
gw32
running install
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 build\temp.win32-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

在解决了最开始的“错误:安装脚本退出,错误:找不到 vcvarsall.bat”之后,我现在面临的情况就像一个复杂的难题。pipeasy-install都无法使用。我也看过一些其他的文章。

目前我并不急于实现bcrypt,所以这不是一个紧急问题,但显然,实施安全的密码保护是非常重要的。

2 个回答

0

我发现最简单的方法就是直接下载和安装现成的Windows版本,而不是自己去编译。这个人把一些文件放在了bitbucket上

0

假设你在使用 mingw64,你需要在 bcrypt.c、bcrypt_python.c 和 pybc_blf.h 文件中的条件编译指令里,把 _MSC_VER 改成 _WIN32。

(我也回复了另一个问题)

撰写回答