pip install sasl
error: Microsoft Visual C++ 14.0 is required. Get it with “Microsoft Visual C++ Build Tools”: http://landinghub.visualstudio.com/visual-cpp-build-tools
此错误需要安装Visual Studio
安装地址:
https://pan.baidu.com/s/1WaBxFghTll6Zofz1DGOZBg
安装完之后需要打开visual Studio试运行一下
或者重启电脑
error: command’C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\cl.exe’ failed with exit status 2
sasl版本不对,卸了重新安装
下不了考虑采用:
conda install sasl (推荐)
还下不了去 https://www.lfd.uci.edu/~gohlke/pythonlibs/#sasl 下载对应版本,我Python3.6,win764位下载的是 :
sasl‑0.2.1‑cp36‑cp36m‑win_amd64.whl
在Python里输入
import pip._internal
print(pip._internal.pep425tags.get_supported())
可以查看你的pip支持的配置
到下载目录 pip install sasl‑0.2.1‑cp36‑cp36m‑win_amd64.whl(有可能需要先 pip install wheel)
pip install thrift_sasl
error:‘TSocket’ object has no attribute 'isOpen’
报错尝试:pip install thrift_sasl==0.2.1 --no-deps(这里我的sasl也是0.2.1)
pip install thrift或(pip install thrift==0.9.3)
版本可参考
pip install thriftpy
来源https://blog.csdn.net/Xiblade/article/details/82318294
pip install impyla
from impala.dbapi import connect
from impala.util import as_pandas
conn=connect(host='****',port=10000,user='***',auth_mechanism='PLAIN',
database='***')
cursor = conn.cursor()
cursor.execute('show databases')
print(as_pandas(cursor))
ThriftParserError: ThriftPy does not support generating module with path in protocol 'd’
D:\Anaconda3\Lib\site-packages\thriftpy\parser\parser.py的
if url_scheme == '':
with open(path) as fh:
data = fh.read()
elif url_scheme in ('http', 'https'):
data = urlopen(path).read()
else:
raise ThriftParserError('ThriftPy does not support generating module '
'with path in protocol \'{}\''.format(
url_scheme))
更改为
if url_scheme == '':
with open(path) as fh:
data = fh.read()
elif url_scheme in ('c', 'd','e','f''):
with open(path) as fh:
data = fh.read()
elif url_scheme in ('http', 'https'):
data = urlopen(path).read()
else:
raise ThriftParserError('ThriftPy does not support generating module '
'with path in protocol \'{}\''.format(
url_scheme))
命令行使用python -m py_comile parser.py 进行编译,即可
原文:https://blog.csdn.net/sinolover/article/details/77714648
(记得保存,用jupyter跑的记得重启程序!!)
module ‘sasl’ has no attribute 'Client’
sasl没删干净,建议手动删了重下,或参考
https://stackoverflow.com/questions/25278607/how-to-fix-error-attributeerror-module-object-has-no-attribute-client-in-p
thriftpy.protocol.exc.TProtocolException:TProtocolException(type=4)
连接的时候没有定义字段auth_mechanism
TypeError: can’t concat str to bytes
D:\Anaconda3\Lib\site-packages\thrift_sasl_init_.py
第94行代码
def _send_message(self, status, body):
header = struct.pack(">BI", status, len(body))
self._trans.write(header + body)
self._trans.flush()
改为
def _send_message(self, status, body):
header = struct.pack(">BI", status, len(body))
if(type(body) is str):
body = body.encode()
self._trans.write(header + body)
self._trans.flush()
原文:https://www.codercto.com/a/35849.html
其他参考:
https://www.codercto.com/a/35849.html
https://blog.csdn.net/Xiblade/article/details/82318294
https://www.cnblogs.com/free-easy0000/p/9638982.html
https://blog.csdn.net/qq_24908345/article/details/80595948