2016-11-14 149 views
2

最近,我已经安装了Cassandra. 3.6 安装后,出现错误。cqlsh :: ImportError:无法导入名称cql_keywords_reserved

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与我的错误?

+0

'pip install cassandra-driver == 3.7.1'?或者安装python 2.7.11(或更少)http://thelastpickle.com/blog/2016/08/16/cqlsh-broken-on-fresh-installs.html这个错误是因为3.7中的cqlsh在python中使用api司机3分支 –

+0

@ChrisLohfink。我试着用卡桑德拉司机。仍然有相同的错误 –

回答

1

你正在看到CASSANDRA-11840,它发生在使用Python 2.7.12+的旧版本驱动程序中。

要解决它,无论是

1)升级到卡桑德拉3.8+,其捆绑不具有此问题的驱动程序版本。

2)使您的环境/ PATH使用Python < = 2.7.11

3)CQLSH_NO_BUNDLED = 1,你猜到了,但安装版本的驱动程序有修补程序(cassandra-driver> = 3.4.0)。

+0

我已经按照你的第一个选项。我仍然遇到另一个错误。 –

+0

'连接错误:(无法连接到任何服务器',{'127.0.0.1':错误(111,“尝试连接到[('127.0.0.1',9042)]上一次错误:连接被拒绝”)} )' –

+0

这通常表明Cassandra没有运行。 –

相关问题