我正在尝试pip安装Flask的各种扩展。到目前为止,他们都成功了,我安装flask, flask-bcrypt等都没有问题,除了flask-user。
当我尝试pip安装flask-user时,我得到的第一个错误是"Failed building wheel for py-bcrypt"。
然后出现以下内容:
Failed to build py-bcrypt
Installing collected packages: py-bcrypt, pycrypto, flask-user
Running setup.py install for py-bcrypt
Complete output from command C:Python27Scriptsvenv_flaskScriptspython.e
xe -c "import setuptools, tokenize;__file__='c:\users\brandon\appdata\local
temp\pip-build-czloyh\py-bcrypt\setup.py';exec(compile(getattr(tokenize, 'op
en', open)(__file__).read().replace('rn', 'n'), __file__, 'exec'))" install -
-record c:usersbrandonappdatalocaltemppip-nk4rxx-recordinstall-record.txt
--single-version-externally-managed --compile --install-headers C:Python27Scr
iptsvenv_flaskincludesitepython2.7py-bcrypt:
running install
running build
running build_py
running build_ext
building 'bcrypt._bcrypt' extension
C:UsersBrandonAppDataLocalProgramsCommonMicrosoftVisual C++ for Pyth
on9.0VCBincl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:Python27include
-IC:Python27Scriptsvenv_flaskPC /Tcbcrypt/bcrypt.c /Fobuildtemp.win32-2.7R
eleasebcrypt/bcrypt.obj
bcrypt.c
bcrypt/bcrypt.c(139) : warning C4996: '_snprintf': This function or variable
may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use
_CRT_SECURE_NO_WARNINGS. See online help for details.
C:UsersBrandonAppDataLocalProgramsCommonMicrosoftVisual C++
for Python9.0VCIncludestdio.h(358) : see declaration of '_snprintf'
bcrypt/bcrypt.c(249) : warning C4996: '_snprintf': This function or variable
may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use
_CRT_SECURE_NO_WARNINGS. See online help for details.
C:UsersBrandonAppDataLocalProgramsCommonMicrosoftVisual C++
for Python9.0VCIncludestdio.h(358) : see declaration of '_snprintf'
C:UsersBrandonAppDataLocalProgramsCommonMicrosoftVisual C++ for Pyth
on9.0VCBincl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:Python27include
-IC:Python27Scriptsvenv_flaskPC /Tcbcrypt/bcrypt_pbkdf.c /Fobuildtemp.win32
-2.7Releasebcrypt/bcrypt_pbkdf.obj
bcrypt_pbkdf.c
C:UsersBrandonAppDataLocalProgramsCommonMicrosoftVisual C++ for Pyth
on9.0VCBincl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:Python27include
-IC:Python27Scriptsvenv_flaskPC /Tcbcrypt/bcrypt_python.c /Fobuildtemp.win3
2-2.7Releasebcrypt/bcrypt_python.obj
bcrypt_python.c
bcrypt/bcrypt_python.c(63) : warning C4244: 'function' : conversion from 'lo
ng' to 'u_int8_t', possible loss of data
C:UsersBrandonAppDataLocalProgramsCommonMicrosoftVisual C++ for Pyth
on9.0VCBincl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:Python27include
-IC:Python27Scriptsvenv_flaskPC /Tcbcrypt/blowfish.c /Fobuildtemp.win32-2.7
Releasebcrypt/blowfish.obj
blowfish.c
c:usersbrandonappdatalocaltemppip-build-czloyhpy-bcryptbcryptpybc_b
lf.h(86) : error C2146: syntax error : missing ')' before identifier 'passlen'
c:usersbrandonappdatalocaltemppip-build-czloyhpy-bcryptbcryptpybc_b
lf.h(86) : error C2081: 'size_t' : name in formal parameter list illegal
c:usersbrandonappdatalocaltemppip-build-czloyhpy-bcryptbcryptpybc_b
lf.h(86) : error C2061: syntax error : identifier 'passlen'
c:usersbrandonappdatalocaltemppip-build-czloyhpy-bcryptbcryptpybc_b
lf.h(86) : error C2059: syntax error : ';'
c:usersbrandonappdatalocaltemppip-build-czloyhpy-bcryptbcryptpybc_b
lf.h(86) : error C2059: syntax error : ','
c:usersbrandonappdatalocaltemppip-build-czloyhpy-bcryptbcryptpybc_b
lf.h(88) : error C2059: syntax error : ')'
c:usersbrandonappdatalocaltemppip-build-czloyhpy-bcryptbcryptpybc_b
lf.h(91) : error C2146: syntax error : missing ')' before identifier 'n'
c:usersbrandonappdatalocaltemppip-build-czloyhpy-bcryptbcryptpybc_b
lf.h(91) : error C2081: 'size_t' : name in formal parameter list illegal
c:usersbrandonappdatalocaltemppip-build-czloyhpy-bcryptbcryptpybc_b
lf.h(91) : error C2061: syntax error : identifier 'n'
c:usersbrandonappdatalocaltemppip-build-czloyhpy-bcryptbcryptpybc_b
lf.h(91) : error C2059: syntax error : ';'
c:usersbrandonappdatalocaltemppip-build-czloyhpy-bcryptbcryptpybc_b
lf.h(91) : error C2059: syntax error : ')'
error: command 'C:\Users\Brandon\AppData\Local\Programs\Common\Micros
oft\Visual C++ for Python\9.0\VC\Bin\cl.exe' failed with exit status 2
我不想冒险漏掉任何东西。然而,我认为这个错误消息的关键部分是这一部分:
bcrypt/bcrypt.c(139) : warning C4996: '_snprintf': This function or variable
may be unsafe. Consider using _snprintf_s instead. To disable deprecation, use
_CRT_SECURE_NO_WARNINGS. See online help for details.
我相信微软的Visual Basic有问题。然而,当我在网上查的时候,我没有得到任何好的答案。我正在使用Microsoft Visual Basic c++的Python 2.7编译器
我在网上没有看到任何其他问题似乎可以解决我的问题。有些很接近,但它们似乎提供的解决方案与我的问题无关(引用我不使用/拥有的文件等)
你只需要为你的python版本安装python-dev。
这是Microsoft Visual Studio的一个问题,现在似乎已经修复了。