Help Center/ Image Recognition/ SDK Reference/ Using the Python SDK/ Preparing a Python Development Environment
Updated on 2024-12-05 GMT+08:00

Preparing a Python Development Environment

Configuring the Environment

To use the Python SDK of Image Recognition, you need to configure the Python development environment.

  1. Download Python of a proper version from Python's official website and install it. Python3.3 or later is recommended. This section uses Python 3.7 as an example.
  2. Download the latest version of PyCharm from PyCharm's official website.
  3. Start the PyCharm development tool and choose File > Settings > Project Interpreter to configure the Python environment.
  4. Select the Python installation path. See Figure 1. After selecting the target Python, click Apply at the bottom of the page to complete the configuration.
    Figure 1 Configuring the python environment using PyCharm

Obtaining and Installing an SDK

To obtain and install the Python SDK, you are advised to use pip commands or PyCharm. You need to install the huaweicloudsdkcore and huaweicloudsdkimage packages as follows:

Install the SDK using pip commands:
# Install the core library.
pip install huaweicloudsdkcore

# Install the image service library.
pip install huaweicloudsdkimage

To install the Python SDK using PyCharm, perform the following steps:
1. Start PyCharm and choose File > Settings...
2. Click Python Interpreter and then +.
3. Click +, search for huaweicloudsdkcore and huaweicloudsdkimage, and click Install Package in the lower left corner to install the packages.
Figure 2 Installing the Python SDK for Image Recognition using PyCharm