windows安装HIVE连接库pyhs2

问题1:

《windows安装HIVE连接库pyhs2》 image.png

解决方案:
安装Visual C++ python编译器 VCForPython27.exe

问题:2:

linux 或 mac直接安装pyhs2 很是easy,直接pip install pyhs2 。
但是在windows上会遇到各种问题,详细问题如下:

C:\Users\XXXX>pip install pyhs2
Collecting pyhs2
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/fd/12/151a1347077c0aa1c8c6b4a0f2d41a315f544e1b0f9cb41ff982c78cb2f8/pyhs2-0.6.0.tar.gz
Collecting sasl (from pyhs2)
  Cache entry deserialization failed, entry ignored
  Using cached https://files.pythonhosted.org/packages/8e/2c/45dae93d666aea8492678499e0999269b4e55f1829b1e4de5b8204706ad9/sasl-0.2.1.tar.gz
Requirement already satisfied: thrift in c:\python27\lib\site-packages (from pyhs2)
Requirement already satisfied: six in c:\python27\lib\site-packages (from sasl->pyhs2)
Installing collected packages: sasl, pyhs2
  Running setup.py install for sasl ... error
    Complete output from command C:\Python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\XXX\\appdata\\local\\temp\\pip-build-y9ymtz\\sasl\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\XXX\appdata\local\temp\pip-yptvkh-record\install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-2.7
    creating build\lib.win-amd64-2.7\sasl
    copying sasl\__init__.py -> build\lib.win-amd64-2.7\sasl
    running egg_info
    writing requirements to sasl.egg-info\requires.txt
    writing sasl.egg-info\PKG-INFO
    writing top-level names to sasl.egg-info\top_level.txt
    writing dependency_links to sasl.egg-info\dependency_links.txt
    warning: manifest_maker: standard file '-c' not found

    reading manifest file 'sasl.egg-info\SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'sasl.egg-info\SOURCES.txt'
    copying sasl\saslwrapper.cpp -> build\lib.win-amd64-2.7\sasl
    copying sasl\saslwrapper.h -> build\lib.win-amd64-2.7\sasl
    copying sasl\saslwrapper.pyx -> build\lib.win-amd64-2.7\sasl
    running build_ext
    building 'sasl.saslwrapper' extension
    creating build\temp.win-amd64-2.7
    creating build\temp.win-amd64-2.7\Release
    creating build\temp.win-amd64-2.7\Release\sasl
    C:\Users\XXX\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Isasl -IC:\Python27\include -IC:\Python27\PC /Tpsasl/saslwrapper.cpp /Fobuild\temp.win-amd64-2.7\Release\sasl/saslwrapper.obj
    saslwrapper.cpp
    sasl/saslwrapper.cpp(247) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
    error: command 'C:\\Users\\XXX\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\amd64\\cl.exe' failed with exit status 2

    ----------------------------------------
Command "C:\Python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\XXX\\appdata\\local\\temp\\pip-build-y9ymtz\\sasl\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\XXX\appdata\local\temp\pip-yptvkh-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\XXX\appdata\local\temp\pip-build-y9ymtz\sasl\
You are using pip version 9.0.1, however version 19.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

解决方案如下:

下载对应的编译包,https://www.lfd.uci.edu/~gohlke/pythonlibs/#sasl
安装版本需要根据自己的电脑做出选择,32位和64位是有区别的。
pip install sasl-0.2.1-cp27-cp27m-win_amd64.whl

    原文作者:小哥不才IT
    原文地址: https://www.jianshu.com/p/666d4ab964fd
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞