我在CentOS和Ubuntu上安裝了redis-py。在嘗試訪問它時,我都遇到同樣的錯誤。redis-py AttributeError:'module'對象沒有屬性
redis-py AttributeError: 'module' object has no attribute
如果我使用Python提示符在同一目錄作爲源這將工作:
>>> import redis
>>> r = redis.Redis(host='localhost', port=6379, db=0)
,但如果我更改目錄它會給錯誤。
>>> import redis
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "redis.py", line 4, in <module>
print redis.__version__
AttributeError: 'module' object has no attribute '__version__'
嘗試使用.py
腳本總是給出錯誤。任何想法我做錯了,以及如何解決它。可能是一個新手Python的東西...
您能否給我們提供更多關於如何安裝redis-py – brice 2013-03-26 23:43:06