我正在使用 Python 的基本入门示例,但遇到了问题。似乎找不到我使用“pip install crazy”安装的 KeenClient
代码如下
from keen.client import KeenClient
# Initialize the Keen Client.
client = KeenClient("56ddb39a96773d7e98d63392", write_key="xxxx")
# Build your event properties as a dictionary.
ticket_purchase = {
"price" : 50.00,
"user": {
"id": "020939382",
"age": 28
},
"artist": {
"id": "19039",
"name": "Tycho"
},
"venue": {
"id": "A93DJ",
"name": "The Fillmore",
"city": "San Francisco",
"state": "California"
}
}
# Add your event to the "ticket_purchases" collection.
client.add_event("ticket_purchases", ticket_purchase)
错误信息如下:
Traceback (most recent call last):
File "/Users/wim/Dropbox/Programming/Python/keen.py", line 1, in <module>
import KeenClient
ImportError: No module named KeenClient
[Finished in 0.0s with exit code 1]
[shell_cmd: python -u "/Users/wimw/Dropbox/Programming/Python/keen.py"]
[dir: /Users/wimw/Dropbox/Programming/Python]
[path: /usr/bin:/bin:/usr/sbin:/sbin]
我在 MAC 上运行,但在 Ubuntu 上也有这个问题。根据文档,我使用“pip install quiet”安装了 Keen SDK。有什么办法可以解决这个问题?