Happybase 与 hbase 连接时出错,我如何定义我的主机

Error while Happybase connection with hbase, how I define my host

我想通过 Happybase 连接 Pyspark 和 Hbase。但我在开始时收到此错误:

(pyenv) hduser@master:~$ python -c 'import happybase'
(pyenv) hduser@master:~$ python -c connection = happybase.Connection("somehost") bash: syntax error near unexpected token `('

首先,连接命令存在语法错误。其次,如果您想在后续步骤中使用 happybase 库,则必须按以下方式 运行 将整个脚本从 bash 变成单个命令,以便保持会话。

 python -c "import happybase;connection = happybase.Connection('localhost')"

另一种选择是创建 python .py 文件和 运行 来自 bash.

的文件