栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

pyhive 安装及问题解决

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

pyhive 安装及问题解决

pyhive 安装及问题解决 1.排除安装包是否冲突

由于我安装了anaconda,所以conda下载的包和pip下载的包可能导致冲突,使用conda list查看包,我这里为了干净,将conda可能重复的全部卸载了

conda uninstall sasl
conda uninstall thrift_sasl
conda uninstall thrift
conda uninstall pyhive
2.安装工具包

由于我是在windows环境下的conda环境,不能直接pip install sasl,就算安装上也不能使用,先到这里【https://www.lfd.uci.edu/~gohlke/pythonlibs/】下载win对应sasl的.whl安装文件到本地
下载我python3.8对应的版本:

就保存到本地桌面吧:

cd到桌面目录安装:

pip install wheel
pip install sasl-0.3.1-cp38-cp38-win_amd64.whl


其他包正常安装即可:

pip install thrift
pip install thrift_sasl
pip install pyhive
3.测试
from pyhive import hive
conn = hive.Connection(host='node001',port=10000,username='hive')
cursor = conn.cursor()
cursor.execute('show tables')
for result in cursor.fetchall():
    print(result)


如果要连接kerberos认证的hive:

conn = hive.Connect(host='XXXX',port=10000,auth='KERBEROS',kerberos_service_name="hive")
4.错误解决 4.1 sasl报错:

thrift.transport.TTransport.TTransportException: Could not start SASL: b’Error in sasl_client_start (-4) SASL(-4): no mechanism available: Unable to find a callback: 2’
用everything找到saslPLAIN.dll文件,并复制到C:CMUbinsasl2目录下,这个目录自行创建。

4.2 hive权限错误

使用hive用户,报hive没有/tmp目录权限错误,具体错误懒得回去截图了,给/tmp目录授权给所有用户,反正是我自己玩,没关系

hadoop fs -chmod -R 777 /tmp

还有一点是之前我已经修改了core-site.xml配置

vim $HADOOP_HOME/etc/hadoop/sore-site.xml

添加配置


        hadoop.proxyuser.root.hosts
        *
    
    
        hadoop.proxyuser.root.groups
        *
    
转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/664472.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号