Cassandra cqlsh 无法导入 cqlshhandling

Cassandra cqlsh unable to import cqlshhandling

执行以下命令时:

/usr/bin/cqlsh 127.0.0.1

遇到错误:

Traceback (most recent call last):
  File "/usr/bin/cqlsh.py", line 169, in <module>
    from cqlshlib import cql3handling, cqlhandling, pylexotron, sslhandling, cqlshhandling
ImportError: cannot import name cqlshhandling

尽管我在以下目录中找到了 cqlshhandling.py 脚本:

/usr/lib/python2.7/dist-packages/cqlshlib

命令 which cqlsh 显示 /usr/local/bin/cqlsh。这是来自 pip install cqlsh.

当前使用的命令来自cassandra本身。我要设置什么才能获得 cqlsh 运行?

following answer中说明了正确的方法。

找到cqlshlib所在的路径:

find /usr/lib/ -name cqlshlib

获得的路径(在我的例子中)是:

/usr/lib/python2.7/dist-packages/cqlshlib 

使用以下变量名称导出路径:

export PYTHONPATH=$PYTHONPATH:/usr/lib/python2.7/dist-packages/

通过 pip 安装的 cqlsh 不提供帮助,COPY 函数将导致以下错误:

'module' object has no attribute 'parse_options'