1.安装thrift_sasl
1.安装thrift_sasl
(1)报错
UnicodeDecodeError:'ascii'
codec can't
decode byte 0xe2in
position73:
ordinalnot
i
解决办法:
vim ~/.bashrc(打开用户配置文件)
在文件最后一行添加
export LC_ALL=C
保存
source ~/.bashrc 使改动生效
(2)报错
sslerror: the read operaion timee out
解决方法:pip --default-timeout=100 install thrift_sasl
(3)报错
sasl/saslwrapper.h:22:23:
error: sasl/sasl.h: No such fileordirectory
解决方法:
centenOs:yum install gcc-c++ python-devel.x86_64 cyrus-sasl-devel.x86_64
ubuntu/deepin: sudo apt-get install libsasl2-devubuntu/deepin:
2. 安装sasl: pip install sasl
3. 安装impyla: pip install impyla
(1)报错
2. 编写代码测试
from impala.dbapi import connect
conn = connect(host='127.0.0.1', port=10000, database='default', auth_mechanism='PLAIN') cur = conn.cursor() cur.execute('select '+type +', income, count(*) from adults GROUP by ' + type+',income') results = cur.fetchall()