cql是否支持python 3?

时间:2013-06-30 12:28:56

标签: python python-3.x cassandra thrift cql

cql是否支持python3?

我尝试用pip安装但是失败了。

rabit@localhost:/usr/bin> pip-3.3 install cql
^CDownloading/unpacking cql
Operation cancelled by user
Storing complete log in /home/rabit/.pip/pip.log
rabit@localhost:/usr/bin> sudo pip-3.3 install cql
root's password:
Downloading/unpacking cql
  Downloading cql-1.4.0.tar.gz (76kB): 76kB downloaded
  Running setup.py egg_info for package cql

Downloading/unpacking thrift (from cql)
  Running setup.py egg_info for package thrift
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/tmp/pip-build/thrift/setup.py", line 45
        except DistutilsPlatformError, x:
                                     ^
    SyntaxError: invalid syntax
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 16, in <module>

  File "/tmp/pip-build/thrift/setup.py", line 45

    except DistutilsPlatformError, x:

                                 ^

SyntaxError: invalid syntax

----------------------------------------
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build/thrift

实际上cql依赖于Thrift,它可能不支持python3

任何解决方案??

3 个答案:

答案 0 :(得分:4)

Thrift确实明确地不支持Python 3,它的元数据被标记为仅支持Python 2,并且安装它会给你一个语法错误。

解决方案是联系Thrift的作者并帮助他们port to Python 3。一旦完成,请帮助端口cql。更新通常很容易(除了在某些特殊情况下)并且很有趣!

答案 1 :(得分:2)

不,cql与Python 3兼容。它依赖于thrift,一个 Python 3兼容的软件包本身:

Traceback (most recent call last):
  File "<string>", line 16, in <module>
  File "/Users/mj/Development/venvs/stackoverflow-3.3/build/thrift/setup.py", line 45
    except DistutilsPlatformError, x:
                                 ^
SyntaxError: invalid syntax

cql本身在cqltypes.py中使用相同的过时语法:

except (ValueError, AssertionError, IndexError), e:

首先需要移植thriftcql

答案 2 :(得分:-1)

对于Python 3,您可以使用CQLEngine