ImportError: No module named datadog

ImportError: No module named datadog

我是数据狗的新手。我按照这个 post,并替换了我的 app/api 键。

我有:nginx_dd.py

# Make sure you replace the API and/or APP key below
# with the ones for your account

from datadog import initialize, api
import time

options = {
    'api_key': '***',
    'app_key': '***'
}

initialize(**options)

now = int(time.time())
query = 'system.cpu.idle{*}by{host}'
print api.Metric.query(start=now - 3600, end=now, query=query)

当我运行它python nginx_dd.py时,我一直在

ImportError: No module named datadog


对此的任何提示/建议都会有很大的帮助!

验证您的环境中是否安装了 datadog 包。

您可以使用以下命令执行此操作:

$ pip freeze | grep datadog

如果没有安装,可以用这个命令安装:

$ pip install datadog