Updated on 2023-07-19 GMT+08:00

Configuring the Python Environment

Scenario

If you are preparing for secondary development, you need to deploy the environment as required in Table 1.

Table 1 Development environment

Item

Description

Operating system (OS)

Windows OS. Windows 7 or later is recommended.

Python

Python 2.7.10, 3.4.0, or later versions are required. The Visual C++ compilation environment is required, and Visual C++ build tools or Visual Studio must be installed.

Python dependencies

The DLI Python SDK dependencies include urllib3 1.15 or later, six 1.10 or later, certifi, and python-dateutil.

Procedure

  1. Download Python from Python's official website and install it.

    1. Install Python according to the Python official guidelines.
    2. Check whether the configurations succeed. Specifically, at the Start menu, enter cmd and press Enter to bring up the command prompt window. Enter python and press Enter. If the version information is displayed, as shown in Figure 1, Python is successfully installed and configured.
      Figure 1 Checking the configuration

    If an error similar to "error: Microsoft Visual C++ xx.x is required. Get it with Build Tools for Visual Studio" is reported when you install the Python application package, the C++ compiler may not been installed. Install the Visual Studio compiler of the required version. For some OSs, restart the system after Visual Studio is installed

  2. Install DLI Python SDK.

    1. Select the package of the Downloading SDK and decompress the installation package.

      Decompress dli-sdk-python-<version>.zip to a local directory that can be adjusted.

    2. Install the SDK.
      1. On a PC running the Windows OS, choose Start > Run, enter cmd, and press Enter.
      2. In the command-line interface (CLI) window, access the windows directory in the directory where dli-sdk-python-<version>.zip is decompressed. For example, D:\tmp\dli-sdk-python-1.0.8.
      3. Run the following command to install DLI Python SDK (During the installation, the third-party dependencies are automatically downloaded):

        python setup.py install

        Figure 2 shows the installation result.

        Figure 2 Installing Python SDK