【问题标题】:Cassandra cqlsh unable to import cqlshhandlingCassandra cqlsh 无法导入 cqlshhandling
【发布时间】:2020-03-15 05:21:57
【问题描述】:

执行以下命令时:

/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 运行?

【问题讨论】:

  • 你是怎么安装cqlsh的?有时通过 PIP 重新安装可以解决此问题pip install cqlsh。否则,请检查您的 PATH 并确保您的环境使用的是 Python 2.7.11+。

标签: cassandra ubuntu-18.04 cqlsh


【解决方案1】:

正确的方法在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'

【讨论】:

  • 感谢您发布此信息!很高兴你明白了。
猜你喜欢
  • 2018-08-12
  • 2017-03-28
  • 2021-10-11
  • 2017-12-31
  • 2015-11-22
  • 2016-02-14
  • 2015-12-22
  • 2016-04-11
  • 2020-10-05
相关资源
最近更新 更多