首页 > 解决方案 > 错误 - b'sasl_client_start (-4) SASL(-4) 中的错误:没有可用的机制:无法找到回调:2'

问题描述

我正在尝试通过 Python(Jupyter Notebooks)连接到 HIVE。我已经安装了使用 Python 连接 HIVE 所需的所有软件包 -

sasl                      0.2.1            py37h8a4fda4_1
thrift                    0.13.0                   pypi_0    pypi
thrift-sasl               0.3.0                    pypi_0    pypi
pyhive                    0.6.1                    pypi_0    pypi

from pyhive import hive
conn = hive.Connection(host="xxxxxxx", port=xxxxx, username="xxxxxxxx")

但无法连接,因为它抛出错误:TTransportException: Could not start SASL: b'Error in sasl_client_start (-4) SASL(-4): no mechanism available: Unable to find a callback: 2'.

我错过了什么吗?如何连接?

标签: pythonpython-3.xhive

解决方案


在 Windows 平台上,您需要将 C:\PyProj\MyProj\venv\Lib\site-packages\sasl\sasl2 目录的路径添加到 win reestr。在win命令行中:C:\Windows\system32>REG ADD "HKEY_LOCAL_MACHINE\SOFTWARE\Carnegie Mellon\Project Cyrus\SASL Library" /v SearchPath /t REG_SZ /d "C:\PyProj\MyProj\venv\Lib\site -包\sasl\sasl2"


推荐阅读