Skip to main content
 首页 » 编程设计

python之Cassandra 驱动程序 : ImportError: No module named queue

2025年05月04日13itcoder

我正在 OSX 10.11 上使用 pip 安装 cassandra-driver。 直接从 pip 出来,cassandra-driver 给出了这个错误:

traceback (most recent call last):   File "syncS3ToCassandra.py", line 19, in <module> 
from cassandra.cluster import Cluster   File "cassandra/cluster.py", line 48, in init cassandra.cluster (cassandra/cluster.c:74747)    
File "cassandra/connection.py", line 38, in init cassandra.connection (cassandra/connection.c:28007)  
ImportError: No module named queue 

我还没有尝试从源代码构建 cassandra-driver,但 pip 是推荐的方法。这是我的代码:

from cassandra.cluster import Cluster 
from cassandra.policies import DCAwareRoundRobinPolicy 
 
cluster = Cluster() 
session = cluster.connect('foo') 

请您参考如下方法:

我在我的 mbp 上也遇到了这个问题。并且还有一些其他问题无法卸载六。我使用 easy_install 将版本从 1.4.1 更新到 1.10.0 来修复它。

$sudo easy_install -U six 

希望对您有所帮助。