最近我安装了Cassandra. 3.6
安装后出现错误。
Connection error: ('Unable to connect to any servers', {'127.0.0.1': TypeError('ref() does not take keyword arguments',)})
为了解决这个问题,我遵循了
pip install cassandra-driver==2.7.2
pip install cassandra-driver
export CQLSH_NO_BUNDLED=true
我的Python版本是2.7
现在,当我运行 cqlsh
时,我收到以下错误
Traceback (most recent call last):
File "/usr/bin/cqlsh.py", line 167, in <module>
from cqlshlib import cql3handling, cqlhandling, pylexotron, sslhandling
File "/usr/lib/python2.7/dist-packages/cqlshlib/cql3handling.py", line 17, in <module>
from .cqlhandling import CqlParsingRuleSet, Hint
File "/usr/lib/python2.7/dist-packages/cqlshlib/cqlhandling.py", line 21, in <module>
from cassandra.metadata import cql_keywords_reserved
ImportError: cannot import name cql_keywords_reserved
如何解决这个错误?如何运行 cassandra 而不出现错误?
最佳答案
您正在看到CASSANDRA-11840 ,这种情况发生在使用 Python 2.7.12+ 的旧版本驱动程序中。
要解决这个问题,要么
1.) 升级到 Cassandra 3.8+,其中捆绑了不存在此问题的驱动程序版本。
或
2.) 让您的环境/路径使用 Python <= 2.7.11
或
3.) 正如您所猜测的,CQLSH_NO_BUNDLED=1,但安装具有修复程序的驱动程序版本 (cassandra-driver >= 3.4.0)。
关于python - cqlsh::ImportError:无法导入名称 cql_keywords_reserved,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40598910/