在Win7x64上编译/安装py-bcrypt

时间:2013-04-11 08:54:59

标签: python compilation bcrypt

我有以下设置:

  • Win7 x64
  • Python 3.3
  • Visual Studio 2012 Ultimate

我正在尝试使用pip安装py-bcrypt。最初安装失败,因为找不到vcvars.bat

通过修改指令here,我能够在VS2012编译器上指向python,但是,当我第一次尝试安装时,我得到一系列错误(参见下面的日志)。当我重复安装以将输出通过管道传输到日志文件时,安装报告成功。

但是,看起来安装的版本缺少一些关键功能 - 例如bcrypt.genSalt()方法存在且工作正常但bcrypt.hashpw()未定义。

我会很高兴使用预编译的二进制文件,但是我还没有能够找到任何晚于2.7的python版本

如何让py-bcrypt工作?

点子日志:

(为了简洁,我已经剪断了它跳过的链接)

------------------------------------------------------------
c:\Python33\Scripts\pip-script.py run on 04/11/13 09:10:12
Downloading/unpacking py-bcrypt

  Getting page https://pypi.python.org/simple/py-bcrypt/
  URLs to search for versions for py-bcrypt:
  * https://pypi.python.org/simple/py-bcrypt/
  Getting page http://www.mindrot.org/projects/py-bcrypt/
  Getting page https://code.google.com/p/py-bcrypt/
  Getting page https://code.google.com/p/py-bcrypt/downloads/list
  Getting page http://www.mindrot.org/py-bcrypt.html
  Analyzing links from page https://pypi.python.org/simple/py-bcrypt/
    Found link https://pypi.python.org/packages/source/p/py-bcrypt/py-bcrypt-0.3.tar.gz#md5=ee85276d9ef7bce4086e3b12b182356f (from https://pypi.python.org/simple/py-bcrypt/), version: 0.3
  Analyzing links from page http://www.mindrot.org/projects/py-bcrypt/
    Found link http://www.mindrot.org/files/py-bcrypt/py-bcrypt-0.2.tar.gz (from http://www.mindrot.org/projects/py-bcrypt/), version: 0.2
  Analyzing links from page https://code.google.com/p/py-bcrypt/
  Analyzing links from page https://code.google.com/p/py-bcrypt/downloads/list
    Found link https://py-bcrypt.googlecode.com/files/py-bcrypt-0.3.tar.gz (from https://code.google.com/p/py-bcrypt/downloads/list), version: 0.3
  Analyzing links from page http://www.mindrot.org/projects/py-bcrypt/
    Found link http://www.mindrot.org/files/py-bcrypt/py-bcrypt-0.2.tar.gz (from http://www.mindrot.org/projects/py-bcrypt/), version: 0.2
  Using version 0.3 (newest of versions: 0.3, 0.3, 0.2, 0.2)
  Downloading py-bcrypt-0.3.tar.gz

  Downloading from URL https://pypi.python.org/packages/source/p/py-bcrypt/py-bcrypt-0.3.tar.gz#md5=ee85276d9ef7bce4086e3b12b182356f (from https://pypi.python.org/simple/py-bcrypt/)
  Running setup.py egg_info for package py-bcrypt

    running egg_info
    creating pip-egg-info\py_bcrypt.egg-info
    writing dependency_links to pip-egg-info\py_bcrypt.egg-info\dependency_links.txt
    writing pip-egg-info\py_bcrypt.egg-info\PKG-INFO
    writing top-level names to pip-egg-info\py_bcrypt.egg-info\top_level.txt
    writing manifest file 'pip-egg-info\py_bcrypt.egg-info\SOURCES.txt'
    warning: manifest_maker: standard file '-c' not found


    reading manifest file 'pip-egg-info\py_bcrypt.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'pip-egg-info\py_bcrypt.egg-info\SOURCES.txt'
  Source in c:\users\my.user\appdata\local\temp\pip-build-my.user\py-bcrypt has version 0.3, which satisfies requirement py-bcrypt
Installing collected packages: py-bcrypt

  Running setup.py install for py-bcrypt

    Running command c:\Python33\python.exe -c "import setuptools;__file__='c:\\users\\my.user\\appdata\\local\\temp\\pip-build-my.user\\py-bcrypt\\setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\my.user\appdata\local\temp\pip-sa52mw-record\install-record.txt --single-version-externally-managed
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.3
    creating build\lib.win-amd64-3.3\bcrypt
    copying bcrypt\__init__.py -> build\lib.win-amd64-3.3\bcrypt
    running build_ext
    building 'bcrypt._bcrypt' extension

    creating build\temp.win-amd64-3.3
    creating build\temp.win-amd64-3.3\Release
    creating build\temp.win-amd64-3.3\Release\bcrypt
    C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\Python33\include -Ic:\Python33\include /Tcbcrypt/bcrypt_python.c /Fobuild\temp.win-amd64-3.3\Release\bcrypt/bcrypt_python.obj

    bcrypt_python.c

    bcrypt/bcrypt_python.c(56) : warning C4244: 'function' : conversion from 'long' to 'u_int8_t', possible loss of data

    bcrypt/bcrypt_python.c(57) : warning C4013: 'PyString_FromString' undefined; assuming extern returning int

    bcrypt/bcrypt_python.c(57) : warning C4047: 'return' : 'PyObject *' differs in levels of indirection from 'int'

    bcrypt/bcrypt_python.c(86) : warning C4013: 'bzero' undefined; assuming extern returning int

    bcrypt/bcrypt_python.c(95) : warning C4047: 'return' : 'PyObject *' differs in levels of indirection from 'int'

    bcrypt/bcrypt_python.c(113) : warning C4013: 'Py_InitModule3' undefined; assuming extern returning int

    bcrypt/bcrypt_python.c(113) : warning C4047: '=' : 'PyObject *' differs in levels of indirection from 'int'

    c:\users\my.user\appdata\local\temp\pip-build-my.user\py-bcrypt\bcrypt\bcrypt_python.c(115) : warning C4716: 'init_bcrypt' : must return a value

    C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\Python33\include -Ic:\Python33\include /Tcbcrypt/blowfish.c /Fobuild\temp.win-amd64-3.3\Release\bcrypt/blowfish.obj

    blowfish.c

    C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\Python33\include -Ic:\Python33\include /Tcbcrypt/bcrypt.c /Fobuild\temp.win-amd64-3.3\Release\bcrypt/bcrypt.obj

    bcrypt.c

    bcrypt/bcrypt.c(138) : 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:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\stdio.h(349) : see declaration of '_snprintf'

    bcrypt/bcrypt.c(161) : warning C4013: 'bzero' undefined; assuming extern returning int

    bcrypt/bcrypt.c(208) : warning C4267: '=' : conversion from 'size_t' to 'u_int8_t', possible loss of data

    bcrypt/bcrypt.c(248) : 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:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\stdio.h(349) : see declaration of '_snprintf'

    C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:c:\Python33\libs /LIBPATH:c:\Python33\PCbuild\amd64 /EXPORT:PyInit__bcrypt build\temp.win-amd64-3.3\Release\bcrypt/bcrypt_python.obj build\temp.win-amd64-3.3\Release\bcrypt/blowfish.obj build\temp.win-amd64-3.3\Release\bcrypt/bcrypt.obj /OUT:build\lib.win-amd64-3.3\bcrypt\_bcrypt.pyd /IMPLIB:build\temp.win-amd64-3.3\Release\bcrypt\_bcrypt.lib /MANIFESTFILE:build\temp.win-amd64-3.3\Release\bcrypt\_bcrypt.pyd.manifest

    LINK : error LNK2001: unresolved external symbol PyInit__bcrypt

    build\temp.win-amd64-3.3\Release\bcrypt\_bcrypt.lib : fatal error LNK1120: 1 unresolved externals

    error: command '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\amd64\link.exe"' failed with exit status 1120

    Complete output from command c:\Python33\python.exe -c "import setuptools;__file__='c:\\users\\my.user\\appdata\\local\\temp\\pip-build-my.user\\py-bcrypt\\setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\my.user\appdata\local\temp\pip-sa52mw-record\install-record.txt --single-version-externally-managed:

    running install

running build

running build_py

creating build

creating build\lib.win-amd64-3.3

creating build\lib.win-amd64-3.3\bcrypt

copying bcrypt\__init__.py -> build\lib.win-amd64-3.3\bcrypt

running build_ext

building 'bcrypt._bcrypt' extension

creating build\temp.win-amd64-3.3

creating build\temp.win-amd64-3.3\Release

creating build\temp.win-amd64-3.3\Release\bcrypt

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\Python33\include -Ic:\Python33\include /Tcbcrypt/bcrypt_python.c /Fobuild\temp.win-amd64-3.3\Release\bcrypt/bcrypt_python.obj

bcrypt_python.c

bcrypt/bcrypt_python.c(56) : warning C4244: 'function' : conversion from 'long' to 'u_int8_t', possible loss of data

bcrypt/bcrypt_python.c(57) : warning C4013: 'PyString_FromString' undefined; assuming extern returning int

bcrypt/bcrypt_python.c(57) : warning C4047: 'return' : 'PyObject *' differs in levels of indirection from 'int'

bcrypt/bcrypt_python.c(86) : warning C4013: 'bzero' undefined; assuming extern returning int

bcrypt/bcrypt_python.c(95) : warning C4047: 'return' : 'PyObject *' differs in levels of indirection from 'int'

bcrypt/bcrypt_python.c(113) : warning C4013: 'Py_InitModule3' undefined; assuming extern returning int

bcrypt/bcrypt_python.c(113) : warning C4047: '=' : 'PyObject *' differs in levels of indirection from 'int'

c:\users\my.user\appdata\local\temp\pip-build-my.user\py-bcrypt\bcrypt\bcrypt_python.c(115) : warning C4716: 'init_bcrypt' : must return a value

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\Python33\include -Ic:\Python33\include /Tcbcrypt/blowfish.c /Fobuild\temp.win-amd64-3.3\Release\bcrypt/blowfish.obj

blowfish.c

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Ic:\Python33\include -Ic:\Python33\include /Tcbcrypt/bcrypt.c /Fobuild\temp.win-amd64-3.3\Release\bcrypt/bcrypt.obj

bcrypt.c

bcrypt/bcrypt.c(138) : 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:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\stdio.h(349) : see declaration of '_snprintf'

bcrypt/bcrypt.c(161) : warning C4013: 'bzero' undefined; assuming extern returning int

bcrypt/bcrypt.c(208) : warning C4267: '=' : conversion from 'size_t' to 'u_int8_t', possible loss of data

bcrypt/bcrypt.c(248) : 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:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\stdio.h(349) : see declaration of '_snprintf'

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:c:\Python33\libs /LIBPATH:c:\Python33\PCbuild\amd64 /EXPORT:PyInit__bcrypt build\temp.win-amd64-3.3\Release\bcrypt/bcrypt_python.obj build\temp.win-amd64-3.3\Release\bcrypt/blowfish.obj build\temp.win-amd64-3.3\Release\bcrypt/bcrypt.obj /OUT:build\lib.win-amd64-3.3\bcrypt\_bcrypt.pyd /IMPLIB:build\temp.win-amd64-3.3\Release\bcrypt\_bcrypt.lib /MANIFESTFILE:build\temp.win-amd64-3.3\Release\bcrypt\_bcrypt.pyd.manifest

LINK : error LNK2001: unresolved external symbol PyInit__bcrypt

build\temp.win-amd64-3.3\Release\bcrypt\_bcrypt.lib : fatal error LNK1120: 1 unresolved externals

error: command '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\amd64\link.exe"' failed with exit status 1120

----------------------------------------

Command c:\Python33\python.exe -c "import setuptools;__file__='c:\\users\\my.user\\appdata\\local\\temp\\pip-build-my.user\\py-bcrypt\\setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\my.user\appdata\local\temp\pip-sa52mw-record\install-record.txt --single-version-externally-managed failed with error code 1 in c:\users\my.user\appdata\local\temp\pip-build-my.user\py-bcrypt

Exception information:
Traceback (most recent call last):
  File "c:\Python33\lib\site-packages\pip\basecommand.py", line 139, in main
    status = self.run(options, args)
  File "c:\Python33\lib\site-packages\pip\commands\install.py", line 271, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "c:\Python33\lib\site-packages\pip\req.py", line 1185, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "c:\Python33\lib\site-packages\pip\req.py", line 592, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "c:\Python33\lib\site-packages\pip\util.py", line 662, in call_subprocess
    % (command_desc, proc.returncode, cwd))
pip.exceptions.InstallationError: Command c:\Python33\python.exe -c "import setuptools;__file__='c:\\users\\my.user\\appdata\\local\\temp\\pip-build-my.user\\py-bcrypt\\setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\my.user\appdata\local\temp\pip-sa52mw-record\install-record.txt --single-version-externally-managed failed with error code 1 in c:\users\my.user\appdata\local\temp\pip-build-my.user\py-bcrypt

0 个答案:

没有答案