日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

pyhive的安装

發布時間:2023/12/31 编程问答 45 豆豆
生活随笔 收集整理的這篇文章主要介紹了 pyhive的安装 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

說明名錄

  • 連接hive數據庫
  • linux下安裝pyhive

連接hive數據庫

連接hive數據庫,許多文章推薦pyhive包,經過小仙女本人多次嘗試與周圍童鞋交流,發現window系統貌似無法使用pyhive,mmp!!!

所以window系統下,如何連接hive數據庫?

  • 果斷換包,使用impyla,安裝途中遇到各種坑,可以參考下面絕世好文章:
    https://blog.csdn.net/Xiblade/article/details/82318294
    有童鞋推薦使用happybase,沒有用過,但感覺是一個可以讓人快樂的python包
  • 在電腦硬件還可以情況下,可以選擇裝一個linux虛擬機
    我選擇VMware和Ubantu,方法自行百度,坑很少
  • linux下安裝pyhive

    安裝上了linux系統,再安裝Anoconda,完畢之后打開命令行,依次輸入:

    pip install saslpip install thriftpip install thrift-saslpip install pyhive

    然后你就發現安裝sasl和thrift-sasl又是各種坑,欸,連接一個hive數據庫簡直太難了!報錯如下:

    Collecting saslDownloading https://files.pythonhosted.org/packages/8e/2c/45dae93d666aea8492678499e0999269b4e55f1829b1e4de5b8204706ad9/sasl-0.2.1.tar.gz Requirement already satisfied: six in ./anaconda3/lib/python3.7/site-packages (from sasl) (1.12.0) Building wheels for collected packages: saslBuilding wheel for sasl (setup.py) ... errorERROR: Complete output from command /home/liuju/anaconda3/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-nc9goial/sasl/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-8ytz4zr3 --python-tag cp37:ERROR: running bdist_wheelrunning buildrunning build_pycreating buildcreating build/lib.linux-x86_64-3.7creating build/lib.linux-x86_64-3.7/saslcopying sasl/__init__.py -> build/lib.linux-x86_64-3.7/saslrunning egg_infowriting sasl.egg-info/PKG-INFOwriting dependency_links to sasl.egg-info/dependency_links.txtwriting requirements to sasl.egg-info/requires.txtwriting top-level names to sasl.egg-info/top_level.txtreading 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.linux-x86_64-3.7/saslcopying sasl/saslwrapper.h -> build/lib.linux-x86_64-3.7/saslcopying sasl/saslwrapper.pyx -> build/lib.linux-x86_64-3.7/saslrunning build_extbuilding 'sasl.saslwrapper' extensioncreating build/temp.linux-x86_64-3.7creating build/temp.linux-x86_64-3.7/saslgcc -pthread -B /home/liuju/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Isasl -I/home/liuju/anaconda3/include/python3.7m -c sasl/saslwrapper.cpp -o build/temp.linux-x86_64-3.7/sasl/saslwrapper.occ1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++In file included from sasl/saslwrapper.cpp:254:sasl/saslwrapper.h:22:10: fatal error: sasl/sasl.h: No such file or directory#include <sasl/sasl.h>^~~~~~~~~~~~~compilation terminated.error: command 'gcc' failed with exit status 1----------------------------------------ERROR: Failed building wheel for saslRunning setup.py clean for sasl Failed to build sasl Installing collected packages: saslRunning setup.py install for sasl ... errorERROR: Complete output from command /home/liuju/anaconda3/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-nc9goial/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 /tmp/pip-record-o68u9xve/install-record.txt --single-version-externally-managed --compile:ERROR: running installrunning buildrunning build_pycreating buildcreating build/lib.linux-x86_64-3.7creating build/lib.linux-x86_64-3.7/saslcopying sasl/__init__.py -> build/lib.linux-x86_64-3.7/saslrunning egg_infowriting sasl.egg-info/PKG-INFOwriting dependency_links to sasl.egg-info/dependency_links.txtwriting requirements to sasl.egg-info/requires.txtwriting top-level names to sasl.egg-info/top_level.txtreading 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.linux-x86_64-3.7/saslcopying sasl/saslwrapper.h -> build/lib.linux-x86_64-3.7/saslcopying sasl/saslwrapper.pyx -> build/lib.linux-x86_64-3.7/saslrunning build_extbuilding 'sasl.saslwrapper' extensioncreating build/temp.linux-x86_64-3.7creating build/temp.linux-x86_64-3.7/saslgcc -pthread -B /home/liuju/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Isasl -I/home/liuju/anaconda3/include/python3.7m -c sasl/saslwrapper.cpp -o build/temp.linux-x86_64-3.7/sasl/saslwrapper.occ1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++In file included from sasl/saslwrapper.cpp:254:sasl/saslwrapper.h:22:10: fatal error: sasl/sasl.h: No such file or directory#include <sasl/sasl.h>^~~~~~~~~~~~~compilation terminated.error: command 'gcc' failed with exit status 1---------------------------------------- ERROR: Command "/home/liuju/anaconda3/bin/python -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-nc9goial/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 /tmp/pip-record-o68u9xve/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-nc9goial/sasl/

    其實sasl包的官網上有說明:https://pypi.org/project/sasl/0.1.3/,大概意思就是sasl包依賴gcc

    在安裝pyhive相關包之前安裝gcc,需要在命令行里輸入

    sudo apt-get install python-dev libsasl2-dev gcc



    然后就ojbk了!

    總結

    以上是生活随笔為你收集整理的pyhive的安装的全部內容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。