Install Splunk SDK for Python

Install the Splunk® SDK for Python libraries by doing the following:

  1. Use Easy Install:
  2. [sudo] easy_install splunk-sdk

    Or, use pip:

    [sudo] pip install splunk-sdk

    Or, run on the resources you cloned from GitHub:

    [sudo] python install
  3. Add the root path of the Splunk SDK for Python to the PYTHONPATH environment variable (this is a requirement for running the examples and individual unit tests). For example, add the following line to your ~/.bash_profile:
  4. export PYTHONPATH=~/splunk-sdk-python

You can also install the Python egg from pip:

[sudo] pip install --egg splunk-sdk

Troubleshooting tip

If you get this type of error when you try to run your first program:

From FOO import error, parse
ImportError: No module named FOO

It probably means you still need to add the root directory of the Splunk SDK for Python to your PYTHONPATH.