当pip安装flask-user时,“为py-bcrypt构建轮子失败”

时间:2015-07-29 16:43:20

标签: python visual-c++ flask

我正在尝试为Flask安装各种扩展程序。到目前为止,他们都已经成功了,除了烧瓶用户之外,我没有安装烧瓶,烧瓶加密等问题。

当我尝试pip安装flask-user时,我得到的第一个错误是“为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:\Python27\Scripts\venv_flask\Scripts\python.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('\r\n', '\n'), __file__, 'exec'))" install -
-record c:\users\brandon\appdata\local\temp\pip-nk4rxx-record\install-record.txt
 --single-version-externally-managed --compile --install-headers C:\Python27\Scr
ipts\venv_flask\include\site\python2.7\py-bcrypt:
    running install
    running build
    running build_py
    running build_ext
    building 'bcrypt._bcrypt' extension
    C:\Users\Brandon\AppData\Local\Programs\Common\Microsoft\Visual C++ for Pyth
on\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\include
-IC:\Python27\Scripts\venv_flask\PC /Tcbcrypt/bcrypt.c /Fobuild\temp.win32-2.7\R
elease\bcrypt/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:\Users\Brandon\AppData\Local\Programs\Common\Microsoft\Visual C++
for Python\9.0\VC\Include\stdio.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:\Users\Brandon\AppData\Local\Programs\Common\Microsoft\Visual C++
for Python\9.0\VC\Include\stdio.h(358) : see declaration of '_snprintf'
    C:\Users\Brandon\AppData\Local\Programs\Common\Microsoft\Visual C++ for Pyth
on\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\include
-IC:\Python27\Scripts\venv_flask\PC /Tcbcrypt/bcrypt_pbkdf.c /Fobuild\temp.win32
-2.7\Release\bcrypt/bcrypt_pbkdf.obj
    bcrypt_pbkdf.c
    C:\Users\Brandon\AppData\Local\Programs\Common\Microsoft\Visual C++ for Pyth
on\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\include
-IC:\Python27\Scripts\venv_flask\PC /Tcbcrypt/bcrypt_python.c /Fobuild\temp.win3
2-2.7\Release\bcrypt/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:\Users\Brandon\AppData\Local\Programs\Common\Microsoft\Visual C++ for Pyth
on\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\include
-IC:\Python27\Scripts\venv_flask\PC /Tcbcrypt/blowfish.c /Fobuild\temp.win32-2.7
\Release\bcrypt/blowfish.obj
    blowfish.c
    c:\users\brandon\appdata\local\temp\pip-build-czloyh\py-bcrypt\bcrypt\pybc_b
lf.h(86) : error C2146: syntax error : missing ')' before identifier 'passlen'
    c:\users\brandon\appdata\local\temp\pip-build-czloyh\py-bcrypt\bcrypt\pybc_b
lf.h(86) : error C2081: 'size_t' : name in formal parameter list illegal
    c:\users\brandon\appdata\local\temp\pip-build-czloyh\py-bcrypt\bcrypt\pybc_b
lf.h(86) : error C2061: syntax error : identifier 'passlen'
    c:\users\brandon\appdata\local\temp\pip-build-czloyh\py-bcrypt\bcrypt\pybc_b
lf.h(86) : error C2059: syntax error : ';'
    c:\users\brandon\appdata\local\temp\pip-build-czloyh\py-bcrypt\bcrypt\pybc_b
lf.h(86) : error C2059: syntax error : ','
    c:\users\brandon\appdata\local\temp\pip-build-czloyh\py-bcrypt\bcrypt\pybc_b
lf.h(88) : error C2059: syntax error : ')'
    c:\users\brandon\appdata\local\temp\pip-build-czloyh\py-bcrypt\bcrypt\pybc_b
lf.h(91) : error C2146: syntax error : missing ')' before identifier 'n'
    c:\users\brandon\appdata\local\temp\pip-build-czloyh\py-bcrypt\bcrypt\pybc_b
lf.h(91) : error C2081: 'size_t' : name in formal parameter list illegal
    c:\users\brandon\appdata\local\temp\pip-build-czloyh\py-bcrypt\bcrypt\pybc_b
lf.h(91) : error C2061: syntax error : identifier 'n'
    c:\users\brandon\appdata\local\temp\pip-build-czloyh\py-bcrypt\bcrypt\pybc_b
lf.h(91) : error C2059: syntax error : ';'
    c:\users\brandon\appdata\local\temp\pip-build-czloyh\py-bcrypt\bcrypt\pybc_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编译器

我没有在网上看到任何其他问题似乎解决了我的问题。有些人接近,但他们似乎提供的解决方案与我的问题没有任何关系(对我不使用/有的文件的引用等)。

2 个答案:

答案 0 :(得分:0)

这是Microsoft Visual Studio的一个问题,现在似乎已修补了。请参阅here补丁。

答案 1 :(得分:0)

你只需要为你的python版本安装python-dev。