This topic describes how to create a development environment that can run code examples for Alibaba Cloud Server Load Balancer (SLB) SDK for Python. The Alibaba Cloud SDK for Python supports Python 2.7. To run an SLB SDK example for Python, you need to install the Alibaba Cloud SDK core library for Python and the SLB SDK for Python.


  1. Install Python.
    1. Go to the Python download page.
    2. Download the version 2.7 of Python.

      Click the required platform installation package from the file list. The package is in python-XYZ.msi format, where XYZ is the version number.

    3. Double-click the installation package to run the installation wizard. Use the default configurations to install Python.
    4. Set environment variables.
      Add the Python installation path and the directory of pip to the value of the Path variable. Separate two directories by using a semicolon (;).
    5. In the command line interface, run Python commands. If the following message is displayed, it means that you have set up a Python environment and Python is installed.
      Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26) [MSC v.1500 64 bit (AM
      D64)] on win32
      Type "help", "copyright", "credits" or "license" for more information.
  2. Install Alibaba Cloud SDK core library for Python.
    Run the following command to install the Alibaba Cloud SDK core library for Python:
    pip install aliyun-python-sdk-core

    For Python and pip user guide information, see Python documentation.

  3. Run the following command to install the SLB SDK for Python:
    pip install aliyun-python-sdk-slb
  4. Run the following command to install the SDK of CloudMonitor, through which you can view the monitoring data of SLB (such as the number of connections, the number of packets, and inbound and outbound traffic):
    pip install aliyun-python-sdk-cms
  5. Optional:Run the following command if you need CloudShell to run the SDK file. Use --user commands to install the SDK and run the file.
    pip install --user aliyun-python-sdk-cms
    python install --user