Before you can use Log Service SDK for Python to perform operations on Log Service, you must install Log Service SDK for Python. This topic describes how to install Log Service SDK for Python.

Prerequisites

  • Log Service is activated. For more information, see Activate Log Service.
  • An AccessKey pair is created and obtained. An Alibaba Cloud account has permissions to call all API operations. Therefore, security risks may arise if you use the AccessKey pair of an Alibaba Cloud account. We recommend that you log on as a RAM user that has permissions to call API operations or perform routine O&M. For more information, see AccessKey pair.
  • A Python development environment is installed. For more information, visit the official website of Python.

    Log Service SDK for Python supports the following versions of Python: PyPy 2, PyPy 3, Python 2.6, Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6, and Python 3.7. You can run the python-V command to check the version of Python that is installed.

  • The pip tool is installed to manage Python packages. For more information, visit the official website of pip.
    If pip is installed, you can run the pip-V command to check the version of pip that is installed. If pip is not installed, you can download the installation package from the official website of pip and then install pip.
    Note In Windows, if the 'pip' is not recognized as an internal or external command error appears, add the installation paths of Python and pip to the Path environment variable. The installation path of pip is in the Scripts folder in the Python installation directory. After you configure the settings, you may need to restart your computer to enable the environment variables.

Install Log Service SDK for Python

Run the following command as an administrator in the command-line interface (CLI) to install Log Service SDK for Python:
pip install -U aliyun-log-python-sdk
The following example shows a success response that is returned if Log Service SDK for Python is installed:
Successfully installed aliyun-log-python-sdk-0.6.54 certifi-2021.5.30 dateparser-1.0.0 elasticsearch-7.13.4 jmespath-0.10.0 protobuf-3.17.3 regex-2021.7.6 tzlocal-2.1

What to do next

Get started with Log Service SDK for Python