简体   繁体   English

Cassandra 自动完成功能不起作用

[英]Cassandra auto-complete does not work

I have a problem with the auto-complete within Cassandra 3.9 client "cqlsh", I don't know why?我在 Cassandra 3.9 客户端“cqlsh”中的自动完成有问题,我不知道为什么? I did an update my brew command on MacOS Sierra.我在 MacOS Sierra 上更新了我的 brew 命令。 I suppose this problem is for a python update, but how it's related?我想这个问题是针对 python 更新的,但它是如何相关的?

I tried to execute the tests:我尝试执行测试:

$ cd apache-cassandra-3.9/pylib/cqlshlib/test
$ python test_cqlsh_completion.py

but I got this error:但我收到了这个错误:

Traceback (most recent call last):
  File "test_cqlsh_completion.py", line 23, in <module>
    from .basecase import BaseTestCase, cqlsh
ValueError: Attempted relative import in non-package

Someone know any solution?有人知道任何解决方案吗?

If I list the directory it shows:如果我列出它显示的目录:

$ ls apache-cassandra-3.9/pylib/cqlshlib/test

__init__.py              basecase.py              
run_cqlsh.py             test_cqlsh_commands.py   
test_cqlsh_invocation.py test_cqlsh_parsing.py    
winpty.py                ansi_colors.py           
cassconnect.py           test_cql_parsing.py      
test_cqlsh_completion.py test_cqlsh_output.py     
test_keyspace_init.cql

Install pyreadline run this command安装pyreadline运行此命令

pip install pyreadline

pyreadline reference pyreadline 参考

I run this command on我运行这个命令

Windows 7 64 bits视窗 7 64 位

Python 2.7.12蟒蛇 2.7.12

你的包文件夹中没有__init__.py

I encountered this problem also.我也遇到了这个问题。 Check to see how many python you have.检查你有多少蟒蛇。

which -a python

I had 2 Python2s and somehow 2.7.15 was the default binary and cqlsh did not work that well with this version (autocomplete and history did not work).我有 2 个 Python2,不知何故 2.7.15 是默认二进制文件,而 cqlsh 在这个版本上运行得不好(自动完成和历史记录不起作用)。

The fix for me was to put Python 2.7.10 in path before 2.7.15我的解决方法是将 Python 2.7.10 放在 2.7.15 之前的路径中

I had a similar issue.我有一个类似的问题。 The root of the problem was with python's readline package问题的根源在于 python 的readline

please, try请尝试

python -c 'import readline'

if you get an error, it will guide you to the solution如果出现错误,它将引导您找到解决方案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM