aerospike python在centos 7下不工作

aerospike python在centos 7下不工作,python,python-3.x,aerospike,Python,Python 3.x,Aerospike,我所拥有的 运行aerospike,测试sql,一切正常 通过pip3安装aerospike在同一台机器上安装客户端库 centos 7的python版本默认值 Python 3.4.9 此页面的示例无效 https://www.aerospike.com/docs/client/python/index.html 删除try/except块后,出现以下错误: Traceback (most recent call last): File "/tmp

我所拥有的

  • 运行aerospike,测试sql,一切正常
  • 通过pip3安装aerospike在同一台机器上安装客户端库

  • centos 7的python版本默认值

            Python 3.4.9
    
  • 此页面的示例无效

           https://www.aerospike.com/docs/client/python/index.html
    
删除try/except块后,出现以下错误:

Traceback (most recent call last):
  File "/tmp/aerospike.py", line 4, in <module>
    import aerospike
  File "/tmp/aerospike.py", line 12, in <module>
    client = aerospike.client(config).connect()
AttributeError: 'module' object has no attribute 'client'

您有名称空间冲突。Aerospike客户端模块称为
Aerospike
。您的本地脚本名为
aerospike.py
。导入的工作方式是Python将首先在本地查找,然后在类似pip的REPO中查找。它在本地看到您的脚本,并尝试再次加载它


尝试将脚本重命名为
aerospike test.py

请显示您的
pip列表和您正在尝试的实际代码段。你想试试文档中的代码吗?我尝试了page.ops中的精确代码。是的,没想过。但现在我有另一个错误。ImportError:“aerospike”中的错误幻数:b'\x03\xf3\r\n'此问题已得到回答。用代码示例打开另一个,并清除问题中的错误代码,而不是要回答的注释中的错误代码。是的,谢谢。另一个错误是由于同一目录中的aerospike.pyc。哦,是的。好发现!
pip3 list
Package                Version 
---------------------- --------
aerospike              3.5.0   
asn1crypto             0.24.0  
atomicwrites           1.2.1   
attrs                  18.2.0  
cassandra-driver       3.15.1  
cffi                   1.11.5  
cryptography           2.3.1   
diff-match-patch       20121119
Django                 2.0.9   
django-chunked-upload  1.1.3   
django-compat          1.0.15  
django-crispy-forms    1.7.2   
django-datatable-view  0.9.0   
django-datatables-view 1.17.0  
django-hijack          2.1.10  
django-import-export   1.1.0   
django-queryset-csv    1.0.1   
django-simple-menu     1.2.1   
django-tables2         2.0.2   
django-tracking2       0.4.1   
et-xmlfile             1.0.1   
future                 0.17.1  
GeoIP                  1.3.2   
idna                   2.7     
importlib-metadata     0.6     
jdcal                  1.4     
more-itertools         4.3.0   
mysqlclient            1.3.13  
odfpy                  1.3.6   
openpyxl               2.5.9   
path.py                11.5.0  
pathlib2               2.3.2   
pidfile                0.1.1   
pika                   0.12.0  
pip                    18.1    
pluggy                 0.8.0   
py                     1.7.0   
pycall                 2.3.2   
pycparser              2.19    
PyMySQL                0.9.2   
pytest                 4.0.1   
python-dateutil        2.7.5   
python-http-client     3.1.0   
pytz                   2018.7  
PyYAML                 3.13    
scandir                1.9.0   
sendgrid               5.6.0   
setuptools             19.6.2  
six                    1.11.0  
tablib                 0.12.1  
unicodecsv             0.14.1  
xlrd                   1.1.0   
xlwt                   1.3.0