Prerequisites

更新时间:
复制 MD 格式

This topic explains how to set up a Python development environment and install the SDK.

Before you begin

  • You have activated the AI Search Open Platform service. For instructions, see Activate the service.

  • You need an API key to authenticate calls to the AI Search Open Platform service. To obtain an API key, see Obtain an API key.

Set up your environment

  • Use Python 3.7 or later.

  • Run the python --version command to check your Python version.

Install the SDK

Use pip to install the SDK:

pip install alibabacloud_searchplat20240529

To call a model from an independent deployment, you must upgrade the SDK to version 1.4.0 or later:

pip install --upgrade alibabacloud_searchplat20240529

Notes

When upgrading the SDK to version 2.0 or later, you must also upgrade the following core packages to avoid version conflicts.

  1. Check your SDK version:

     pip show alibabacloud-searchplat20240529
    (.venv) PS C:\Users\issuser\PycharmProjects\OStest1> pip show alibabacloud-searchplat20240529
    Name: alibabacloud-searchplat20240529
    Version: 2.0.1
    Summary: Alibaba Cloud Searchplat (20240529) SDK Library for Python
    Home-page: https://github.com/aliyun/alibabacloud-python-sdk
    Author: Alibaba Cloud SDK
    Author-email: sdk-team@alibabacloud.com
    License: Apache License 2.0
    Location: c:\users\issuser\pycharmprojects\pythonproject5\.venv\lib\site-packages
    Requires: alibabacloud-gateway-pop, alibabacloud-openapi-util, alibabacloud-tea-openapi, alibabacloud-tea-util
    Required-by:
    (.venv) PS C:\Users\issuser\PycharmProjects\OStest1>
  2. Upgrade the packages:

    pip install --upgrade alibabacloud-tea-openapi==0.3.15
    pip install --upgrade alibabacloud-gateway-spi==0.0.3
    pip install --upgrade alibabacloud_gateway_pop==0.0.8
    pip install --upgrade alibabacloud_credentials==1.0