大数据

win10 安装pyhive

文 / sptk 来源 / 原创 阅读 / 279 10月前

安装pyhive环境

#  注意python环境需要是3.10 以及一下,最新版本不支持 主要是sasl库问题导致的
# 安装过程要比较麻烦,设计到sasl库的编译问题
pip install pyhive

# 安装pyhive依赖的包
pip install thrift_sasl

# 安装ssl
#  下载ssl 离线包 https://www.lfd.uci.edu/~gohlke/pythonlibs/#sasl 注意要下载对应版本 1. 解释器版本 2. 系统版本 一般都是64位 我下载的是 sasl-0.3.1-cp310-cp310-win_amd64.whl
#  终端切换到你的下载路径 ,或者 whl文件指定决定路径也可以
pip install sasl-0.3.1-cp310-cp310-win_amd64.whl

# 安装 thrift
pip install thrift

# 安装 thrift-sasl
pip install thrift-sasl

测试pyhive

from pyhive import hive

conn = hive.Connection(host='hiveip', port=10000, username='用户名',password='hive密码')  # 如果没密码 password参数可以不用取掉

with conn.cursor() as cursor:
    cursor.execute('show databases')
    print(cursor.fetchall())

0

站点声明:站点主要用于个人技术文章。

冀ICP备19037883号
相关侵权、举报、投诉及建议等,请发E-mail:804330969@qq.com