我刚刚brew
在Mac OS X 10.9.4上安装了Cassandra :
? ~ brew info cassandra cassandra: stable 2.1.0 http://cassandra.apache.org /usr/local/Cellar/cassandra/2.0.9 (3466 files, 79M) * Built from source From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/cassandra.rb ==> Caveats If you plan to use the CQL shell (cqlsh), you will need the Python CQL library installed. Since Homebrew prefers using pip for Python packages, you can install that using: pip install cql To have launchd start cassandra at login: ln -sfv /usr/local/opt/cassandra/*.plist ~/Library/LaunchAgents Then to load cassandra now: launchctl load ~/Library/LaunchAgents/homebrew.mxcl.cassandra.plist ? ~ uname -a Darwin xxx 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun 3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
正如上面的信息消息中所建议的,安装cql
我执行sudo easy_install pip
后跟pip install cql
.
安装软件后,执行时cqlsh
我面临错误:
? ~ cqlsh Traceback (most recent call last): File "/usr/local/bin/cqlsh", line 2084, inmain(*read_options(sys.argv[1:], os.environ)) File "/usr/local/bin/cqlsh", line 2067, in main single_statement=options.execute) File "/usr/local/bin/cqlsh", line 509, in __init__ self.output_codec = codecs.lookup(encoding) LookupError: unknown encoding:
我该如何解决?
经过一些谷歌搜索和调试后,结果表明调用locale.getpreferredencoding()
期望正确LC_ALL
,如22.2所述.locale - 国际化服务:
为了保持与其他平台的兼容性,不仅测试了LANG变量,还测试了以envvars参数给出的变量列表.将使用第一个被定义的定义.envvars默认使用GNU gettext中使用的搜索路径; 它必须始终包含变量名LANG.GNU gettext搜索路径按顺序包含"LANGUAGE","LC_ALL","LC_CTYPE"和"LANG".
在我的系统LC_ALL
上设置为pl_PL
:
? ~ echo $LC_ALL pl_PL
更改后LC_ALL
到pl
或pl_pl.utf-8
卡桑德拉壳cqlsh
开始罚款:
? ~ export LC_ALL=pl_pl.utf-8 ? ~ cqlsh Connected to Test Cluster at localhost:9160. [cqlsh 4.1.1 | Cassandra 2.0.9 | CQL spec 3.1.1 | Thrift protocol 19.39.0] Use HELP for help. cqlsh>
请参阅OSX上的线程问题启动cqlsh -用于检查您的语言环境的示例Python应用程序的Lion:
python -c 'import locale, codecs; encoding = locale.getpreferredencoding(); print encoding; print codecs.lookup(encoding)'
一旦它工作正常,可以考虑解决问题.